[Python-checkins] r46946 - in python/trunk: Lib/shelve.py Misc/NEWS

georg.brandl python-checkins at python.org
Wed Jun 14 08:08:31 CEST 2006


Author: georg.brandl
Date: Wed Jun 14 08:08:31 2006
New Revision: 46946

Modified:
   python/trunk/Lib/shelve.py
   python/trunk/Misc/NEWS
Log:
Bug #1339007: Shelf objects now don't raise an exception in their
__del__ method when initialization failed.


Modified: python/trunk/Lib/shelve.py
==============================================================================
--- python/trunk/Lib/shelve.py	(original)
+++ python/trunk/Lib/shelve.py	Wed Jun 14 08:08:31 2006
@@ -139,6 +139,9 @@
         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):

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Jun 14 08:08:31 2006
@@ -156,6 +156,9 @@
 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.
 


More information about the Python-checkins mailing list