From: Serhiy Storchaka Date: Thu, 21 May 2015 11:19:20 +0000 (+0300) Subject: Issue #22955: Fixed reference leak in attrgetter.repr(). X-Git-Tag: v3.5.0b1~54 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=548de2b210d60e4619c69269685ca66a59b29b6b;p=python Issue #22955: Fixed reference leak in attrgetter.repr(). --- diff --git a/Modules/_operator.c b/Modules/_operator.c index 9e4db58d76..735affcdbb 100644 --- a/Modules/_operator.c +++ b/Modules/_operator.c @@ -825,8 +825,10 @@ attrgetter_repr(attrgetterobject *ag) if (ag->nattrs == 1) { PyObject *attrsep = NULL; PyObject *attr = dotjoinattr(PyTuple_GET_ITEM(ag->attr, 0), &attrsep); - if (attr != NULL) + if (attr != NULL) { repr = PyUnicode_FromFormat("%s(%R)", Py_TYPE(ag)->tp_name, attr); + Py_DECREF(attr); + } Py_XDECREF(attrsep); } else {