https://github.com/python/cpython/commit/41b3f0af266b408438cab36625c6ad71040d38e5
commit: 41b3f0af266b408438cab36625c6ad71040d38e5
branch: main
author: Irit Katriel <[email protected]>
committer: iritkatriel <[email protected]>
date: 2026-08-29T22:40:37+01:00
summary:

gh-156466: fix cleanup on error after Enter in codegen_enter_scope (#156467)

files:
M Python/codegen.c

diff --git a/Python/codegen.c b/Python/codegen.c
index 875c963a6078c6..79b84f13e629c7 100644
--- a/Python/codegen.c
+++ b/Python/codegen.c
@@ -700,13 +700,13 @@ codegen_enter_scope(compiler *c, identifier name, int 
scope_type,
          * of 0. This is because RETURN_GENERATOR pushes the generator
          before returning. */
         location loc = LOCATION(lineno, lineno, -1, -1);
-        ADDOP(c, loc, RETURN_GENERATOR);
-        ADDOP(c, loc, POP_TOP);
+        ADDOP_IN_SCOPE(c, loc, RETURN_GENERATOR);
+        ADDOP_IN_SCOPE(c, loc, POP_TOP);
     }
 
-    ADDOP_I(c, loc, RESUME, RESUME_AT_FUNC_START);
+    ADDOP_I_IN_SCOPE(c, loc, RESUME, RESUME_AT_FUNC_START);
     if (scope_type == COMPILE_SCOPE_MODULE) {
-        ADDOP(c, loc, ANNOTATIONS_PLACEHOLDER);
+        ADDOP_IN_SCOPE(c, loc, ANNOTATIONS_PLACEHOLDER);
     }
     return SUCCESS;
 }

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to