[Python-checkins] cpython (merge 3.6 -> default): Merge 3.6 (issue #26182)

yury.selivanov python-checkins at python.org
Tue Nov 8 16:54:48 EST 2016


https://hg.python.org/cpython/rev/7b0e79e7f567
changeset:   104988:7b0e79e7f567
parent:      104986:4d230008ca96
parent:      104987:7a996e826f83
user:        Yury Selivanov <yury at magic.io>
date:        Tue Nov 08 16:54:39 2016 -0500
summary:
  Merge 3.6 (issue #26182)

files:
  Misc/NEWS    |  2 ++
  Python/ast.c |  8 +++++---
  2 files changed, 7 insertions(+), 3 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -109,6 +109,8 @@
 - Issue #26182: Raise DeprecationWarning when async and await keywords are
   used as variable/attribute/class/function name.
 
+- Issue #26182: Fix ia refleak in code that raises DeprecationWarning.
+
 Library
 -------
 
diff --git a/Python/ast.c b/Python/ast.c
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -944,17 +944,19 @@
         PyObject *message = PyUnicode_FromString(
             "'async' and 'await' will become reserved keywords"
             " in Python 3.7");
+        int ret;
         if (message == NULL) {
             return 1;
         }
-        if (PyErr_WarnExplicitObject(
+        ret = PyErr_WarnExplicitObject(
                 PyExc_DeprecationWarning,
                 message,
                 c->c_filename,
                 LINENO(n),
                 NULL,
-                NULL) < 0)
-        {
+                NULL);
+        Py_DECREF(message);
+        if (ret < 0) {
             return 1;
         }
     }

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


More information about the Python-checkins mailing list