summaryrefslogtreecommitdiffstats
path: root/Lib/shelve.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-02-11 02:42:19 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-02-11 02:42:19 (GMT)
commitddb3ed003ecfd5c8d0ddc4880e0c92ac36519d93 (patch)
tree40d4d57b5825309290913dceaff01a8c8d702027 /Lib/shelve.py
parentf8b60b20a576c4d740b3f69fc1cd23f629629517 (diff)
downloadcpython-ddb3ed003ecfd5c8d0ddc4880e0c92ac36519d93.zip
cpython-ddb3ed003ecfd5c8d0ddc4880e0c92ac36519d93.tar.gz
cpython-ddb3ed003ecfd5c8d0ddc4880e0c92ac36519d93.tar.bz2
Merged revisions 78141-78142 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78141 | r.david.murray | 2010-02-10 20:38:42 -0500 (Wed, 10 Feb 2010) | 6 lines Issue 5754: tweak shelve doc wording to make it clearer that even when writeback=True values are written to the backing store when assigned to the shelf. Add test to confirm that this happens. Doc patch and added test by Robert Lehmann. I also fixed the cross references to the sync and close methods. ........ r78142 | r.david.murray | 2010-02-10 20:56:42 -0500 (Wed, 10 Feb 2010) | 3 lines Improve issue 7835 fix per MAL to handle the case that the module dictionary has also been cleared. ........
Diffstat (limited to 'Lib/shelve.py')
-rw-r--r--Lib/shelve.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/shelve.py b/Lib/shelve.py
index 8271dfe..52e471a 100644
--- a/Lib/shelve.py
+++ b/Lib/shelve.py
@@ -136,11 +136,12 @@ class Shelf(collections.MutableMapping):
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'):