[Python-checkins] cpython: Issue #22955: Fixed reference leak in attrgetter.repr().

serhiy.storchaka python-checkins at python.org
Thu May 21 13:19:59 CEST 2015


https://hg.python.org/cpython/rev/2688655e431a
changeset:   96184:2688655e431a
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu May 21 14:19:20 2015 +0300
summary:
  Issue #22955: Fixed reference leak in attrgetter.repr().

files:
  Modules/_operator.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Modules/_operator.c b/Modules/_operator.c
--- a/Modules/_operator.c
+++ b/Modules/_operator.c
@@ -825,8 +825,10 @@
     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 {

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list