Skip to content

Commit ddcb620

Browse files
committed
Issue #15404: Refleak in PyMethodObject repr.
1 parent 3be7a8b commit ddcb620

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ What's New in Python 3.2.4
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #15404: Refleak in PyMethodObject repr.
14+
1315
- Issue #15394: An issue in PyModule_Create that caused references to
1416
be leaked on some error paths has been fixed. Patch by Julia Lawall.
1517

Objects/classobject.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,10 @@ method_repr(PyMethodObject *a)
243243
else {
244244
klassname = PyObject_GetAttrString(klass, "__name__");
245245
if (klassname == NULL) {
246-
if (!PyErr_ExceptionMatches(PyExc_AttributeError))
246+
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
247+
Py_XDECREF(funcname);
247248
return NULL;
249+
}
248250
PyErr_Clear();
249251
}
250252
else if (!PyUnicode_Check(klassname)) {

0 commit comments

Comments
 (0)