[Python-checkins] cpython (merge 3.5 -> 3.6): Merge 3.5 (issue #27942)

yury.selivanov python-checkins at python.org
Wed Nov 9 09:43:45 EST 2016


https://hg.python.org/cpython/rev/b671ac7ae620
changeset:   105011:b671ac7ae620
branch:      3.6
parent:      105007:1f7baa4c8b43
parent:      105010:2c6825c9ecfd
user:        Yury Selivanov <yury at magic.io>
date:        Wed Nov 09 09:43:08 2016 -0500
summary:
  Merge 3.5 (issue #27942)

files:
  Misc/NEWS            |  2 ++
  Objects/codeobject.c |  2 ++
  2 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -588,6 +588,8 @@
 
 - Issue #28008: Implement PEP 530 -- asynchronous comprehensions.
 
+- Issue #27942: Fix memory leak in codeobject.c
+
 Library
 -------
 
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -77,6 +77,7 @@
             intern_string_constants(v);
         }
         else if (PyFrozenSet_CheckExact(v)) {
+            PyObject *w = v;
             PyObject *tmp = PySequence_Tuple(v);
             if (tmp == NULL) {
                 PyErr_Clear();
@@ -89,6 +90,7 @@
                 }
                 else {
                     PyTuple_SET_ITEM(tuple, i, v);
+                    Py_DECREF(w);
                     modified = 1;
                 }
             }

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


More information about the Python-checkins mailing list