[Python-checkins] r78142 - python/trunk/Lib/shelve.py
r.david.murray
python-checkins at python.org
Thu Feb 11 02:56:42 CET 2010
Author: r.david.murray
Date: Thu Feb 11 02:56:42 2010
New Revision: 78142
Log:
Improve issue 7835 fix per MAL to handle the case that the
module dictionary has also been cleared.
Modified:
python/trunk/Lib/shelve.py
Modified: python/trunk/Lib/shelve.py
==============================================================================
--- python/trunk/Lib/shelve.py (original)
+++ python/trunk/Lib/shelve.py Thu Feb 11 02:56:42 2010
@@ -145,11 +145,12 @@
self.dict.close()
except AttributeError:
pass
- # _ClosedDict can be None when close is called from __del__ during shutdown
- if _ClosedDict is None:
- self.dict = None
- else:
+ # Catch errors that may happen when close is called from __del__
+ # because CPython is in interpreter shutdown.
+ try:
self.dict = _ClosedDict()
+ except (NameError, TypeError):
+ self.dict = None
def __del__(self):
if not hasattr(self, 'writeback'):
More information about the Python-checkins
mailing list