This commit is contained in:
Benjamin Peterson 2012-05-08 09:22:45 -04:00
commit 1cffbac2cb
1 changed files with 4 additions and 2 deletions

View File

@ -3709,6 +3709,7 @@ add_methods(PyTypeObject *type, PyMethodDef *meth)
for (; meth->ml_name != NULL; meth++) {
PyObject *descr;
int err;
if (PyDict_GetItemString(dict, meth->ml_name) &&
!(meth->ml_flags & METH_COEXIST))
continue;
@ -3732,9 +3733,10 @@ add_methods(PyTypeObject *type, PyMethodDef *meth)
}
if (descr == NULL)
return -1;
if (PyDict_SetItemString(dict, meth->ml_name, descr) < 0)
return -1;
err = PyDict_SetItemString(dict, meth->ml_name, descr);
Py_DECREF(descr);
if (err < 0)
return -1;
}
return 0;
}