]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #26182: Fix ia refleak in code that raises DeprecationWarning.
authorYury Selivanov <yury@magic.io>
Tue, 8 Nov 2016 21:54:18 +0000 (16:54 -0500)
committerYury Selivanov <yury@magic.io>
Tue, 8 Nov 2016 21:54:18 +0000 (16:54 -0500)
Misc/NEWS
Python/ast.c

index 7a4fa3a35ab72aae7ba7771809dbcfd032e2769a..361e6082ca81ad07165c3eca96300e5b204c2fea 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -18,6 +18,8 @@ Core and Builtins
   should result in PendingDeprecationWarning in 3.5 and in
   DeprecationWarning in 3.6.
 
+- Issue #26182: Fix ia refleak in code that raises DeprecationWarning.
+
 Library
 -------
 
index fcd1563a69a558486d57b48f658b6a66f8a192b7..bfae6ed7d4adc4132c7a033090ee26d0128d3ab2 100644 (file)
@@ -944,17 +944,19 @@ forbidden_name(struct compiling *c, identifier name, const node *n,
         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;
         }
     }