summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-05-21 11:19:20 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-05-21 11:19:20 (GMT)
commit548de2b210d60e4619c69269685ca66a59b29b6b (patch)
tree33e5c93bfa112726a92bfb0aacbe6cacfa15a7d3 /Modules
parentb1cc37cfb59a5f8689a9b2dd8a545ac821a87275 (diff)
downloadcpython-548de2b210d60e4619c69269685ca66a59b29b6b.zip
cpython-548de2b210d60e4619c69269685ca66a59b29b6b.tar.gz
cpython-548de2b210d60e4619c69269685ca66a59b29b6b.tar.bz2
Issue #22955: Fixed reference leak in attrgetter.repr().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_operator.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_operator.c b/Modules/_operator.c
index 9e4db58..735affc 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 {