Skip to content

Commit

Permalink
silence error log in __del__ method if conn is lost when closing
Browse files Browse the repository at this point in the history
  • Loading branch information
janrygl committed Apr 27, 2016
1 parent 4c86390 commit 24eed80
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sqlitedict.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,13 @@ def terminate(self):

def __del__(self):
# like close(), but assume globals are gone by now (do not log!)
self.close(do_log=False)
try:
self.close(do_log=False)
except Exception:
# prevent error log flood in case of multiple SqliteDicts
# closed after connection lost (exceptions are always ignored
# in __del__ method.
pass

# Adding extra methods for python 2 compatibility (at import time)
if major_version == 2:
Expand Down

0 comments on commit 24eed80

Please sign in to comment.