Commit 548de2b2 authored by Serhiy Storchaka's avatar Serhiy Storchaka

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

parent b1cc37cf
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment