mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #23865: close() methods in multiple modules now are idempotent and more
robust at shutdown. If needs to release multiple resources, they are released even if errors are occured.
This commit is contained in:
parent
842f00e725
commit
7e7a3dba5f
27 changed files with 299 additions and 197 deletions
|
@ -248,8 +248,10 @@ class _Database(collections.MutableMapping):
|
|||
raise error('DBM object has already been closed') from None
|
||||
|
||||
def close(self):
|
||||
self._commit()
|
||||
self._index = self._datfile = self._dirfile = self._bakfile = None
|
||||
try:
|
||||
self._commit()
|
||||
finally:
|
||||
self._index = self._datfile = self._dirfile = self._bakfile = None
|
||||
|
||||
__del__ = close
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue