mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
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:
parent
5ec186b1cb
commit
c25fd3fb48
2 changed files with 57 additions and 5 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue