]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport 38951:
authorNeal Norwitz <nnorwitz@gmail.com>
Thu, 5 Jan 2006 08:00:55 +0000 (08:00 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Thu, 5 Jan 2006 08:00:55 +0000 (08:00 +0000)
fixes pybsddb SF bug id 1215432.  DB.associate() would crash when a
DBError was supposed to be raised.

Misc/NEWS
Modules/_bsddb.c

index 9ca6aac62fe4c03a58e41e693e8b59da120bd5a2..50d0a5af890173ab3520ff7470a61729d66d94f6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -38,6 +38,9 @@ Core and builtins
 Extension Modules
 -----------------
 
+- Bug #1215432: in bsddb DB.associate() would crash when a DBError
+  was supposed to be raised.
+
 - Fix 64-bit problems in bsddb.
 
 - Bug #1290333: Added a workaround for cjkcodecs' _codecs_cn build
index a834cbaa6637c42c860d3bb04b204ea48d040bd0..ab10e769387321525a68d25df42c7e46c74cbd68 100644 (file)
@@ -1174,9 +1174,7 @@ DB_associate(DBObject* self, PyObject* args, PyObject* kwargs)
     }
 
     /* Save a reference to the callback in the secondary DB. */
-    if (self->associateCallback != NULL) {
-        Py_DECREF(self->associateCallback);
-    }
+    Py_XDECREF(secondaryDB->associateCallback);
     Py_INCREF(callback);
     secondaryDB->associateCallback = callback;
     secondaryDB->primaryDBType = _DB_get_type(self);
@@ -1210,8 +1208,8 @@ DB_associate(DBObject* self, PyObject* args, PyObject* kwargs)
     MYDB_END_ALLOW_THREADS;
 
     if (err) {
-        Py_DECREF(self->associateCallback);
-        self->associateCallback = NULL;
+        Py_XDECREF(secondaryDB->associateCallback);
+        secondaryDB->associateCallback = NULL;
         secondaryDB->primaryDBType = 0;
     }