summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-01-05 08:00:55 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-01-05 08:00:55 (GMT)
commit7cd31a520b56be6784bab73ef4414a783bde5d94 (patch)
tree41a05f605d786422406d01ca6ad69abc81c6ae93
parentbd2bd893eaa1018d73c971d5cb82cec84db9ccfa (diff)
downloadcpython-7cd31a520b56be6784bab73ef4414a783bde5d94.zip
cpython-7cd31a520b56be6784bab73ef4414a783bde5d94.tar.gz
cpython-7cd31a520b56be6784bab73ef4414a783bde5d94.tar.bz2
Backport 38951:
fixes pybsddb SF bug id 1215432. DB.associate() would crash when a DBError was supposed to be raised.
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/_bsddb.c8
2 files changed, 6 insertions, 5 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 9ca6aac..50d0a5a 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 a834cba..ab10e76 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;
}