]> granicus.if.org Git - python/commitdiff
* Turn the deadlock situation described in SF bug #775414 into a
authorGregory P. Smith <greg@mad-scientist.com>
Thu, 8 Jun 2006 05:38:11 +0000 (05:38 +0000)
committerGregory P. Smith <greg@mad-scientist.com>
Thu, 8 Jun 2006 05:38:11 +0000 (05:38 +0000)
  DBDeadLockError exception.
* add the test case for my previous dbtables commit.

Lib/bsddb/__init__.py
Lib/bsddb/test/test_dbtables.py

index c004c08a87e3f9a420795f3d6e7a2cb90f694b44..d5ab000513a754892b3f5313430d4801bd7e7c94 100644 (file)
@@ -344,6 +344,7 @@ def _openDBEnv(cachesize):
         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):
index 1128a5a44e1da8e1a8a8491a4af3178ee8720e1f..26e3d3650bc681536663df9908d8409677093d57 100644 (file)
@@ -339,6 +339,16 @@ class TableDBTestCase(unittest.TestCase):
                         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,