summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-07-14 09:08:38 (GMT)
committerGitHub <noreply@github.com>2021-07-14 09:08:38 (GMT)
commite5862f79c16e28f1ec51d179698739a9b2d8c1d2 (patch)
tree7bc78c01297940c15efcdf7bdbc5bf6bcc7cac77 /Python/compile.c
parentf572cbf1faab33d9afbbe3e95738ed6fbe6e48e6 (diff)
downloadcpython-e5862f79c16e28f1ec51d179698739a9b2d8c1d2.zip
cpython-e5862f79c16e28f1ec51d179698739a9b2d8c1d2.tar.gz
cpython-e5862f79c16e28f1ec51d179698739a9b2d8c1d2.tar.bz2
bpo-44616: Mark all clean up instructions at end of named exception block as artificial (GH-27109)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c
index bb5c2ec..81648c5 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -3312,11 +3312,11 @@ compiler_try_except(struct compiler *c, stmt_ty s)
/* second # body */
VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body);
compiler_pop_fblock(c, HANDLER_CLEANUP, cleanup_body);
+ /* name = None; del name; # Mark as artificial */
+ UNSET_LOC(c);
ADDOP(c, POP_BLOCK);
ADDOP(c, POP_BLOCK);
ADDOP(c, POP_EXCEPT);
- /* name = None; del name; # Mark as artificial */
- UNSET_LOC(c);
ADDOP_LOAD_CONST(c, Py_None);
compiler_nameop(c, handler->v.ExceptHandler.name, Store);
compiler_nameop(c, handler->v.ExceptHandler.name, Del);
@@ -3348,7 +3348,6 @@ compiler_try_except(struct compiler *c, stmt_ty s)
return 0;
VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body);
compiler_pop_fblock(c, HANDLER_CLEANUP, cleanup_body);
- /* name = None; del name; # Mark as artificial */
UNSET_LOC(c);
ADDOP(c, POP_BLOCK);
ADDOP(c, POP_EXCEPT);