From: Neal Norwitz Date: Thu, 5 Jan 2006 08:00:55 +0000 (+0000) Subject: Backport 38951: X-Git-Tag: v2.4.3c1~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cd31a520b56be6784bab73ef4414a783bde5d94;p=thirdparty%2FPython%2Fcpython.git Backport 38951: fixes pybsddb SF bug id 1215432. DB.associate() would crash when a DBError was supposed to be raised. --- diff --git a/Misc/NEWS b/Misc/NEWS index 9ca6aac62fe4..50d0a5af8901 100644 --- 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 diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index a834cbaa6637..ab10e7693873 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -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; }