From: Georg Brandl Date: Mon, 20 Feb 2006 20:29:56 +0000 (+0000) Subject: Bug #1210377: close bsddb cursor correctly after NotFoundError. X-Git-Tag: v2.4.3c1~61 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fea6059476c8e6acc043db51119765ba956114c0;p=thirdparty%2FPython%2Fcpython.git Bug #1210377: close bsddb cursor correctly after NotFoundError. --- diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py index cfe554b94548..be8e5774249a 100644 --- a/Lib/bsddb/__init__.py +++ b/Lib/bsddb/__init__.py @@ -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():