diff options
author | Mark Shannon <mark@hotpy.org> | 2021-07-14 10:43:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-14 10:43:56 (GMT) |
commit | 794ff7d505f852dc4e0f94901dc7387afaead3bb (patch) | |
tree | fd74ab4f7ff6cbde5367a4ae16c11f69f6de438a /Python | |
parent | 7e1d6308a3fc536719adcf1df0aa4e9953c12f8b (diff) | |
download | cpython-794ff7d505f852dc4e0f94901dc7387afaead3bb.zip cpython-794ff7d505f852dc4e0f94901dc7387afaead3bb.tar.gz cpython-794ff7d505f852dc4e0f94901dc7387afaead3bb.tar.bz2 |
bpo-44616: Mark all clean up instructions at end of named exception block as artificial (GH-27109) (GH-27135)
(cherry picked from commit e5862f79c16e28f1ec51d179698739a9b2d8c1d2)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c index 7dc0492..78d5fbe 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3220,10 +3220,10 @@ 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); - ADDOP(c, POP_BLOCK); - ADDOP(c, POP_EXCEPT); /* name = None; del name; # Mark as artificial */ c->u->u_lineno = -1; + ADDOP(c, POP_BLOCK); + ADDOP(c, POP_EXCEPT); ADDOP_LOAD_CONST(c, Py_None); compiler_nameop(c, handler->v.ExceptHandler.name, Store); compiler_nameop(c, handler->v.ExceptHandler.name, Del); @@ -3254,7 +3254,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 */ c->u->u_lineno = -1; ADDOP(c, POP_EXCEPT); ADDOP_JUMP(c, JUMP_FORWARD, end); |