Issue #22955: Fixed reference leak in attrgetter.repr().

This commit is contained in:
Serhiy Storchaka 2015-05-21 14:19:20 +03:00
parent b1cc37cfb5
commit 548de2b210
1 changed files with 3 additions and 1 deletions

View File

@ -825,8 +825,10 @@ attrgetter_repr(attrgetterobject *ag)
if (ag->nattrs == 1) { if (ag->nattrs == 1) {
PyObject *attrsep = NULL; PyObject *attrsep = NULL;
PyObject *attr = dotjoinattr(PyTuple_GET_ITEM(ag->attr, 0), &attrsep); 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); repr = PyUnicode_FromFormat("%s(%R)", Py_TYPE(ag)->tp_name, attr);
Py_DECREF(attr);
}
Py_XDECREF(attrsep); Py_XDECREF(attrsep);
} }
else { else {