]> granicus.if.org Git - python/commitdiff
bpo-33132: Fix more reference counting issues in the compiler. (GH-6323)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 31 Mar 2018 23:41:28 +0000 (16:41 -0700)
committerGitHub <noreply@github.com>
Sat, 31 Mar 2018 23:41:28 +0000 (16:41 -0700)
(cherry picked from commit aa8e51f5ebb2a71c76059f050de01fc3c985376a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Python/compile.c

index 03b4826b761bbdf459a2f3e9ed2bc1c3cad7118e..d4245e2f4e5092d1d1d4924bc2a32aaabf7a3c9e 100644 (file)
@@ -2742,8 +2742,7 @@ compiler_import_as(struct compiler *c, identifier name, identifier asname)
             attr = PyUnicode_Substring(name, pos, (dot != -1) ? dot : len);
             if (!attr)
                 return 0;
-            ADDOP_O(c, IMPORT_FROM, attr, names);
-            Py_DECREF(attr);
+            ADDOP_N(c, IMPORT_FROM, attr, names);
             if (dot == -1) {
                 break;
             }
@@ -3207,8 +3206,7 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
                             "param invalid for local variable");
             return 0;
         }
-        ADDOP_O(c, op, mangled, varnames);
-        Py_DECREF(mangled);
+        ADDOP_N(c, op, mangled, varnames);
         return 1;
     case OP_GLOBAL:
         switch (ctx) {