summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2003-01-17 08:42:50 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2003-01-17 08:42:50 (GMT)
commitb6c9f780741711750c326418a7b4578543b2aa65 (patch)
tree3d1138e3f04763a5c00b2f7af53c63e58a4f9195 /Lib
parentaa71f5f2b4a295065fe3c96889e7ff902991ec07 (diff)
downloadcpython-b6c9f780741711750c326418a7b4578543b2aa65.zip
cpython-b6c9f780741711750c326418a7b4578543b2aa65.tar.gz
cpython-b6c9f780741711750c326418a7b4578543b2aa65.tar.bz2
bugfix: do not double-close DB cursor during deallocation when the
underlying DB has already been closed (and thus all of its cursors). This fixes a potential segfault. SF pybsddb bug id 667343 bugfix: close the DB object when raising an exception due to an error during DB.open. This prevents an exception when closing the environment about not all databases being closed. SF pybsddb bug id 667340
Diffstat (limited to 'Lib')
-rw-r--r--Lib/bsddb/test/test_basics.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py
index 7524b35..25cc77c 100644
--- a/Lib/bsddb/test/test_basics.py
+++ b/Lib/bsddb/test/test_basics.py
@@ -398,6 +398,18 @@ class BasicTestCase(unittest.TestCase):
self.fail("no exception raised when using a buggy cursor's"
"%s method" % method)
+ #
+ # free cursor referencing a closed database, it should not barf:
+ #
+ oldcursor = self.d.cursor(txn=txn)
+ self.d.close()
+
+ # this would originally cause a segfault when the cursor for a
+ # closed database was cleaned up. it should not anymore.
+ # SF pybsddb bug id 667343
+ del oldcursor
+
+
#----------------------------------------
def test04_PartialGetAndPut(self):