mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
plug ref leak
This commit is contained in:
parent
39d43b4660
commit
1afec5d6bf
1 changed files with 7 additions and 4 deletions
|
@ -1153,14 +1153,17 @@ dict_subscript(PyDictObject *mp, register PyObject *key)
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
if (!PyDict_CheckExact(mp)) {
|
if (!PyDict_CheckExact(mp)) {
|
||||||
/* Look up __missing__ method if we're a subclass. */
|
/* Look up __missing__ method if we're a subclass. */
|
||||||
PyObject *missing;
|
PyObject *missing, *res;
|
||||||
static PyObject *missing_str = NULL;
|
static PyObject *missing_str = NULL;
|
||||||
missing = _PyObject_LookupSpecial((PyObject *)mp,
|
missing = _PyObject_LookupSpecial((PyObject *)mp,
|
||||||
"__missing__",
|
"__missing__",
|
||||||
&missing_str);
|
&missing_str);
|
||||||
if (missing != NULL)
|
if (missing != NULL) {
|
||||||
return PyObject_CallFunctionObjArgs(missing,
|
res = PyObject_CallFunctionObjArgs(missing,
|
||||||
key, NULL);
|
key, NULL);
|
||||||
|
Py_DECREF(missing);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
else if (PyErr_Occurred())
|
else if (PyErr_Occurred())
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue