[Python-3000-checkins] r57380 - in python/branches/py3k/Lib: bsddb/__init__.py test/test_bsddb.py
gregory.p.smith
python-3000-checkins at python.org
Fri Aug 24 07:32:11 CEST 2007
Author: gregory.p.smith
Date: Fri Aug 24 07:32:10 2007
New Revision: 57380
Modified:
python/branches/py3k/Lib/bsddb/__init__.py
python/branches/py3k/Lib/test/test_bsddb.py
Log:
reapply of r57378 to fix bug 1725856
Modified: python/branches/py3k/Lib/bsddb/__init__.py
==============================================================================
--- python/branches/py3k/Lib/bsddb/__init__.py (original)
+++ python/branches/py3k/Lib/bsddb/__init__.py Fri Aug 24 07:32:10 2007
@@ -266,12 +266,16 @@
def first(self):
self._checkOpen()
+ # fix 1725856: don't needlessly try to restore our cursor position
+ self.saved_dbc_key = None
self._checkCursor()
rv = _DeadlockWrap(self.dbc.first)
return rv
def last(self):
self._checkOpen()
+ # fix 1725856: don't needlessly try to restore our cursor position
+ self.saved_dbc_key = None
self._checkCursor()
rv = _DeadlockWrap(self.dbc.last)
return rv
Modified: python/branches/py3k/Lib/test/test_bsddb.py
==============================================================================
--- python/branches/py3k/Lib/test/test_bsddb.py (original)
+++ python/branches/py3k/Lib/test/test_bsddb.py Fri Aug 24 07:32:10 2007
@@ -131,6 +131,22 @@
items.append(self.f.previous())
self.assertSetEquals(items, self.d.items())
+ def test_first_while_deleting(self):
+ # Test for bug 1725856
+ self.assert_(len(self.d) >= 2, "test requires >=2 items")
+ for _ in self.d:
+ key = self.f.first()[0]
+ del self.f[key]
+ self.assertEqual(0, len(self.f), "expected empty db after test")
+
+ def test_last_while_deleting(self):
+ # Test for bug 1725856's evil twin
+ self.assert_(len(self.d) >= 2, "test requires >=2 items")
+ for _ in self.d:
+ key = self.f.last()[0]
+ del self.f[key]
+ self.assertEqual(0, len(self.f), "expected empty db after test")
+
def test_set_location(self):
self.assertEqual(self.f.set_location('e'), ('e', self.d['e']))
More information about the Python-3000-checkins
mailing list