OS: Windows 2000/Windows XP/Debian-based Linux w/2.6.10 Kernel When the Modify function from the dbtables.py module is called on Berkeley DB it corrupts the file showing an error caused by Line 445 of dbtables.py.
Logged In: YES user_id=33168 Can you create a test case for this? What is the trigger? Just calling the function/method? Do you know if this affects Python 2.4 and HEAD? What version of Berkeley DB?
Logged In: YES user_id=1429720 I'm new to Python so this may be the problem, does the dbtables.Modify function require a function in the mappings. i.e. tdb.Modify('mytable', conditions= {'ID':dbtables.ExactCond('1')}, mappings={'ID':FUNCTION}) where the function returns the new value? (not mappings= {'ID':'newvalue'})
Logged In: YES user_id=764593 Correct, the values in the dictionaries should be callables (usually a function) which take the old value and return the new. That said, the test case would still be useful, because (1) calling a string should raise a TypeError (2) making a mistake should not corrupt the database. Perhaps the first except clause (which triggers a rollback) needs to be a bare except? I'm guess the same is true of some of the other abort() lines...
Logged In: YES user_id=1429720 Very nice .. yes using a bare exception causes the expected TypeError exception. I tried this in Python 2.4 and without any changes it correctly raises TypeError. I checked the differences between the 2.3 dbtables and 2.4 and there are no significant changes (i.e. the Modify catches the same exceptions) so it's got to be somewhere else. I've uploaded a simple test case that creates a database, does an Insert and then attempts the Modify with a string which corrupts the DB in Python 2.3.