[Python-checkins] python/dist/src/Lib/bsddb/test test_basics.py,1.3,1.4

greg@users.sourceforge.net greg@users.sourceforge.net
Thu, 16 Jan 2003 23:53:01 -0800


Update of /cvsroot/python/python/dist/src/Lib/bsddb/test
In directory sc8-pr-cvs1:/tmp/cvs-serv5715/bsddb/test

Modified Files:
	test_basics.py 
Log Message:
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.


Index: test_basics.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_basics.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_basics.py	30 Dec 2002 20:52:08 -0000	1.3
--- test_basics.py	17 Jan 2003 07:52:59 -0000	1.4
***************
*** 605,608 ****
--- 605,628 ----
          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"