Issue #22955: Fixed reference leak in attrgetter.repr().
This commit is contained in:
parent
b1cc37cfb5
commit
548de2b210
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue