summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-05-27 03:08:44 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-05-27 03:08:44 (GMT)
commit1afec5d6bf1f0e5d0cb62e633c69ed37e2f03a9c (patch)
tree65082d149abfec19c9f31bb3fd9f09e60322ea1d /Objects/dictobject.c
parent39d43b46608b13f6248f87df1a4f9ba6c69c6652 (diff)
downloadcpython-1afec5d6bf1f0e5d0cb62e633c69ed37e2f03a9c.zip
cpython-1afec5d6bf1f0e5d0cb62e633c69ed37e2f03a9c.tar.gz
cpython-1afec5d6bf1f0e5d0cb62e633c69ed37e2f03a9c.tar.bz2
plug ref leak
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index dbf6411..c4e6aa5 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -1153,14 +1153,17 @@ dict_subscript(PyDictObject *mp, register PyObject *key)
if (v == NULL) {
if (!PyDict_CheckExact(mp)) {
/* Look up __missing__ method if we're a subclass. */
- PyObject *missing;
+ PyObject *missing, *res;
static PyObject *missing_str = NULL;
missing = _PyObject_LookupSpecial((PyObject *)mp,
"__missing__",
&missing_str);
- if (missing != NULL)
- return PyObject_CallFunctionObjArgs(missing,
- key, NULL);
+ if (missing != NULL) {
+ res = PyObject_CallFunctionObjArgs(missing,
+ key, NULL);
+ Py_DECREF(missing);
+ return res;
+ }
else if (PyErr_Occurred())
return NULL;
}