summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-05-08 13:22:45 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-05-08 13:22:45 (GMT)
commit1cffbac2cbab551a829f0c843233ec98827947b3 (patch)
tree74c658718d0d0b9e9b350b4b0b81b6227c6c7305
parentd3f424fe4546325d74d9511c7de14e452d1cfb05 (diff)
parent89a6e9a27b565d8143c3e064aae92e831ff14801 (diff)
downloadcpython-1cffbac2cbab551a829f0c843233ec98827947b3.zip
cpython-1cffbac2cbab551a829f0c843233ec98827947b3.tar.gz
cpython-1cffbac2cbab551a829f0c843233ec98827947b3.tar.bz2
merge 3.2 (#14752)
-rw-r--r--Objects/typeobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 9babd57..309191e 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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;
}