diff options
author | Georg Brandl <georg@python.org> | 2006-06-14 06:08:31 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-06-14 06:08:31 (GMT) |
commit | 2605ca8773ebf37c840c191a903f168942521aa8 (patch) | |
tree | a2c87ca7a34e35404b378cc38e15540ca83b6186 | |
parent | d825143be1118ba7e320661b3a71d8822ae5d600 (diff) | |
download | cpython-2605ca8773ebf37c840c191a903f168942521aa8.zip cpython-2605ca8773ebf37c840c191a903f168942521aa8.tar.gz cpython-2605ca8773ebf37c840c191a903f168942521aa8.tar.bz2 |
Bug #1339007: Shelf objects now don't raise an exception in their
__del__ method when initialization failed.
-rw-r--r-- | Lib/shelve.py | 3 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Lib/shelve.py b/Lib/shelve.py index 4959c26..7a75445 100644 --- a/Lib/shelve.py +++ b/Lib/shelve.py @@ -139,6 +139,9 @@ class Shelf(UserDict.DictMixin): self.dict = 0 def __del__(self): + if not hasattr(self, 'writeback'): + # __init__ didn't succeed, so don't bother closing + return self.close() def sync(self): @@ -156,6 +156,9 @@ Extension Modules Library ------- +- Bug #1339007: Shelf objects now don't raise an exception in their + __del__ method when initialization failed. + - Patch #1455898: The MBCS codec now supports the incremental mode for double-byte encodings. |