Skip to content

Commit

Permalink
potential thread safety fix
Browse files Browse the repository at this point in the history
- related: #548
  • Loading branch information
casperdcl committed Aug 27, 2019
1 parent 96cd73e commit a347706
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tqdm/std.py
Expand Up @@ -1022,9 +1022,13 @@ def __len__(self):
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()
Expand Down

1 comment on commit a347706

@casperdcl
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.