[Python-checkins] r42526 - python/branches/release24-maint/Lib/bsddb/__init__.py

georg.brandl python-checkins at python.org
Mon Feb 20 21:29:57 CET 2006


Author: georg.brandl
Date: Mon Feb 20 21:29:56 2006
New Revision: 42526

Modified:
   python/branches/release24-maint/Lib/bsddb/__init__.py
Log:
Bug #1210377: close bsddb cursor correctly after NotFoundError.


Modified: python/branches/release24-maint/Lib/bsddb/__init__.py
==============================================================================
--- python/branches/release24-maint/Lib/bsddb/__init__.py	(original)
+++ python/branches/release24-maint/Lib/bsddb/__init__.py	Mon Feb 20 21:29:56 2006
@@ -112,7 +112,10 @@
 
     def iteritems(self):
         try:
-            cur = self._make_iter_cursor()
+            try:
+                cur = self._make_iter_cursor()
+            except AttributeError:
+                return
 
             # FIXME-20031102-greg: race condition.  cursor could
             # be closed by another thread before this call.
@@ -189,7 +192,10 @@
             c = self.dbc
             self.dbc = None
             if save:
-                self.saved_dbc_key = c.current(0,0,0)[0]
+                try:
+                    self.saved_dbc_key = c.current(0,0,0)[0]
+                except db.DBError:
+                    pass                    
             c.close()
             del c
         for cref in self._cursor_refs.values():


More information about the Python-checkins mailing list