mirror of https://github.com/tqdm/tqdm.git
parent
96cd73ec03
commit
a3477060f1
10
tqdm/std.py
10
tqdm/std.py
|
@ -1022,9 +1022,13 @@ class tqdm(Comparable):
|
|||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc):
|
||||
self.close()
|
||||
return False
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
try:
|
||||
self.close()
|
||||
except AttributeError:
|
||||
# maybe eager thread cleanup upon external error
|
||||
if exc_type is None:
|
||||
raise
|
||||
|
||||
def __del__(self):
|
||||
self.close()
|
||||
|
|
Loading…
Reference in New Issue