summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-05-27 03:18:19 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-05-27 03:18:19 (GMT)
commit0ffaaa634d59d24d2707adec7ff395f6fe51bb04 (patch)
tree0cc6de9acc53d7c50c96cdffa8a37fdbb3617221 /Objects
parenta720559878f25f3f8ed46a81260844231bfc9d4b (diff)
downloadcpython-0ffaaa634d59d24d2707adec7ff395f6fe51bb04.zip
cpython-0ffaaa634d59d24d2707adec7ff395f6fe51bb04.tar.gz
cpython-0ffaaa634d59d24d2707adec7ff395f6fe51bb04.tar.bz2
Merged revisions 72958 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72958 | benjamin.peterson | 2009-05-26 22:08:44 -0500 (Tue, 26 May 2009) | 1 line plug ref leak ........
Diffstat (limited to 'Objects')
-rw-r--r--Objects/dictobject.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 97fa60b..f21cea2 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -1126,14 +1126,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;
}