Kaydet (Commit) 031ae6e9 authored tarafından R. David Murray's avatar R. David Murray

Improve issue 7835 fix per MAL to handle the case that the

module dictionary has also been cleared.
üst 7c29f071
...@@ -145,11 +145,12 @@ class Shelf(UserDict.DictMixin): ...@@ -145,11 +145,12 @@ class Shelf(UserDict.DictMixin):
self.dict.close() self.dict.close()
except AttributeError: except AttributeError:
pass pass
# _ClosedDict can be None when close is called from __del__ during shutdown # Catch errors that may happen when close is called from __del__
if _ClosedDict is None: # because CPython is in interpreter shutdown.
self.dict = None try:
else:
self.dict = _ClosedDict() self.dict = _ClosedDict()
except (NameError, TypeError):
self.dict = None
def __del__(self): def __del__(self):
if not hasattr(self, 'writeback'): if not hasattr(self, 'writeback'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment