bugfix: disallow use of DB_TXN after commit() or abort(), prevents a

coredump or segmentation violation.

Sourceforge patch ID 664896:
http://sourceforge.net/tracker/index.php?func=detail&aid=664896&group_id=13900&atid=313900

The bug was reported on the pybsddb-users mailing list.
This commit is contained in:
Gregory P. Smith 2003-01-17 07:52:59 +00:00
parent 5ec186b1cb
commit c25fd3fb48
2 changed files with 57 additions and 5 deletions

View file

@ -604,6 +604,26 @@ class BasicTransactionTestCase(BasicTestCase):
assert num == 0, "truncate on empty DB returned nonzero (%s)" % `num`
txn.commit()
#----------------------------------------
def test08_TxnLateUse(self):
txn = self.env.txn_begin()
txn.abort()
try:
txn.abort()
except db.DBError, e:
pass
else:
raise RuntimeError, "DBTxn.abort() called after DB_TXN no longer valid w/o an exception"
txn = self.env.txn_begin()
txn.commit()
try:
txn.commit()
except db.DBError, e:
pass
else:
raise RuntimeError, "DBTxn.commit() called after DB_TXN no longer valid w/o an exception"
class BTreeTransactionTestCase(BasicTransactionTestCase):