[Python-checkins] r46737 - in python/trunk/Lib/bsddb: __init__.py test/test_dbtables.py

gregory.p.smith python-checkins at python.org
Thu Jun 8 07:38:11 CEST 2006


Author: gregory.p.smith
Date: Thu Jun  8 07:38:11 2006
New Revision: 46737

Modified:
   python/trunk/Lib/bsddb/__init__.py
   python/trunk/Lib/bsddb/test/test_dbtables.py
Log:
* Turn the deadlock situation described in SF bug #775414 into a
  DBDeadLockError exception.
* add the test case for my previous dbtables commit.


Modified: python/trunk/Lib/bsddb/__init__.py
==============================================================================
--- python/trunk/Lib/bsddb/__init__.py	(original)
+++ python/trunk/Lib/bsddb/__init__.py	Thu Jun  8 07:38:11 2006
@@ -344,6 +344,7 @@
         else:
             raise error, "cachesize must be >= 20480"
     e.open('.', db.DB_PRIVATE | db.DB_CREATE | db.DB_THREAD | db.DB_INIT_LOCK | db.DB_INIT_MPOOL)
+    e.set_lk_detect(db.DB_LOCK_DEFAULT)
     return e
 
 def _checkflag(flag, file):

Modified: python/trunk/Lib/bsddb/test/test_dbtables.py
==============================================================================
--- python/trunk/Lib/bsddb/test/test_dbtables.py	(original)
+++ python/trunk/Lib/bsddb/test/test_dbtables.py	Thu Jun  8 07:38:11 2006
@@ -339,6 +339,16 @@
                         conditions={'Name': dbtables.LikeCond('%')},
                         mappings={'Access': increment_access})
 
+        try:
+            self.tdb.Modify(tabname,
+                            conditions={'Name': dbtables.LikeCond('%')},
+                            mappings={'Access': 'What is your quest?'})
+        except TypeError:
+            # success, the string value in mappings isn't callable
+            pass
+        else:
+            raise RuntimeError, "why was TypeError not raised for bad callable?"
+
         # Delete key in select conditions
         values = self.tdb.Select(
             tabname, None,


More information about the Python-checkins mailing list