]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Bug #1210377: close bsddb cursor correctly after NotFoundError.
authorGeorg Brandl <georg@python.org>
Mon, 20 Feb 2006 20:29:56 +0000 (20:29 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 20 Feb 2006 20:29:56 +0000 (20:29 +0000)
Lib/bsddb/__init__.py

index cfe554b9454821dc814fc853848b836e43ea5435..be8e5774249ae57485fd11a1bcec03372ffc60ac 100644 (file)
@@ -112,7 +112,10 @@ class _iter_mixin(UserDict.DictMixin):
 
     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 @@ class _DBWithCursor(_iter_mixin):
             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():