From 7cd31a520b56be6784bab73ef4414a783bde5d94 Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Thu, 5 Jan 2006 08:00:55 +0000 Subject: [PATCH] Backport 38951: fixes pybsddb SF bug id 1215432. DB.associate() would crash when a DBError was supposed to be raised. --- Misc/NEWS | 3 +++ Modules/_bsddb.c | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) 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; } -- 2.47.3