diff --git a/Objects/classobject.c b/Objects/classobject.c index 305c07e4944..6d49228f479 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -1559,7 +1559,6 @@ instancemethod_repr(a) fname = PyString_AS_STRING(funcname); else fname = "?"; - Py_XDECREF(funcname); if (fclassname != NULL && PyString_Check(fclassname)) fcname = PyString_AsString(fclassname); else @@ -1575,6 +1574,7 @@ instancemethod_repr(a) sprintf(buf, "", fcname, fname, icname, (long)self); } + Py_XDECREF(funcname); return PyString_FromString(buf); }