diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-09-15 19:14:19 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-15 19:14:19 (GMT) |
| commit | ffde4cddc9c79eb21267186c82415e1bd438cd90 (patch) | |
| tree | 2a34215f601b96eec6d135209218159be639ba63 /Python | |
| parent | b2a7d718e3b70922f46208c22750c33145dccb75 (diff) | |
| download | cpython-ffde4cddc9c79eb21267186c82415e1bd438cd90.zip cpython-ffde4cddc9c79eb21267186c82415e1bd438cd90.tar.gz cpython-ffde4cddc9c79eb21267186c82415e1bd438cd90.tar.bz2 | |
[3.12] gh-98442: fix locations of with statement's cleanup instructions (GH-120763) (#120787)
gh-98442: fix locations of with statement's cleanup instructions (GH-120763)
(cherry picked from commit 55596ae0446e40f47e2a28b8897fe9530c32a19a)
gh-98442: fix location of with statement's cleanup instructions
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/compile.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c index 7255f5d..3b25e99 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -135,6 +135,7 @@ enum fblocktype { WHILE_LOOP, FOR_LOOP, TRY_EXCEPT, FINALLY_TRY, FINALLY_END, struct fblockinfo { enum fblocktype fb_type; jump_target_label fb_block; + location fb_loc; /* (optional) type-specific exit or cleanup block */ jump_target_label fb_exit; /* (optional) additional information required for unwinding */ @@ -1467,6 +1468,7 @@ compiler_push_fblock(struct compiler *c, location loc, f = &c->u->u_fblock[c->u->u_nfblocks++]; f->fb_type = t; f->fb_block = block_label; + f->fb_loc = loc; f->fb_exit = exit; f->fb_datum = datum; return SUCCESS; @@ -1594,7 +1596,7 @@ compiler_unwind_fblock(struct compiler *c, location *ploc, case WITH: case ASYNC_WITH: - *ploc = LOC((stmt_ty)info->fb_datum); + *ploc = info->fb_loc; ADDOP(c, *ploc, POP_BLOCK); if (preserve_tos) { ADDOP_I(c, *ploc, SWAP, 2); |
