]> granicus.if.org Git - python/commitdiff
bpo-32365: Fix a reference leak when compile __debug__. (GH-4916) (#4918)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 18 Dec 2017 13:11:51 +0000 (05:11 -0800)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 18 Dec 2017 13:11:51 +0000 (15:11 +0200)
It was introduced in bpo-27169.
(cherry picked from commit bd6ec4d79e8575df3d08f8a89ba721930032714c)

Python/compile.c

index 13b4fb830766139e1496ea19e3c9d5a4894f6bac..3b8f9bbd4426c5eb734a01c95588d3fa7b94f46f 100644 (file)
@@ -3032,10 +3032,6 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
     PyObject *mangled;
     /* XXX AugStore isn't used anywhere! */
 
-    mangled = _Py_Mangle(c->u->u_private, name);
-    if (!mangled)
-        return 0;
-
     assert(!_PyUnicode_EqualToASCIIString(name, "None") &&
            !_PyUnicode_EqualToASCIIString(name, "True") &&
            !_PyUnicode_EqualToASCIIString(name, "False"));
@@ -3045,6 +3041,10 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
         return 1;
     }
 
+    mangled = _Py_Mangle(c->u->u_private, name);
+    if (!mangled)
+        return 0;
+
     op = 0;
     optype = OP_NAME;
     scope = PyST_GetScope(c->u->u_ste, mangled);