Issue #15404: Refleak in PyMethodObject repr.

This commit is contained in:
Andrew Svetlov 2012-07-20 14:51:45 +03:00
parent 3be7a8bbcf
commit ddcb6206bf
2 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,8 @@ What's New in Python 3.2.4
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #15404: Refleak in PyMethodObject repr.
- Issue #15394: An issue in PyModule_Create that caused references to - Issue #15394: An issue in PyModule_Create that caused references to
be leaked on some error paths has been fixed. Patch by Julia Lawall. be leaked on some error paths has been fixed. Patch by Julia Lawall.

View File

@ -243,8 +243,10 @@ method_repr(PyMethodObject *a)
else { else {
klassname = PyObject_GetAttrString(klass, "__name__"); klassname = PyObject_GetAttrString(klass, "__name__");
if (klassname == NULL) { if (klassname == NULL) {
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
Py_XDECREF(funcname);
return NULL; return NULL;
}
PyErr_Clear(); PyErr_Clear();
} }
else if (!PyUnicode_Check(klassname)) { else if (!PyUnicode_Check(klassname)) {