From a223d2cb29a27ea25632cfe695401a4ced96ca06 Mon Sep 17 00:00:00 2001
From: Georg Brandl <georg@python.org>
Date: Mon, 20 Feb 2006 20:29:52 +0000
Subject: Bug #1210377: close bsddb cursor correctly after NotFoundError.

---
 Lib/bsddb/__init__.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py
index 4903584..b7bd482 100644
--- a/Lib/bsddb/__init__.py
+++ b/Lib/bsddb/__init__.py
@@ -191,7 +191,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():
-- 
cgit v0.12

