mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-44616: Mark all clean up instructions at end of named exception block as artificial (GH-27109) (GH-27135)
(cherry picked from commit e5862f79c1
)
This commit is contained in:
parent
7e1d6308a3
commit
794ff7d505
2 changed files with 25 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue