mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
[3.13] gh-120225: fix crash in compiler on empty block at end of exception handler (GH-120235) (#120249)
gh-120225: fix crash in compiler on empty block at end of exception handler (GH-120235)
(cherry picked from commit 4fc82b6d3b
)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
parent
6238174e47
commit
3be7e91d03
3 changed files with 13 additions and 6 deletions
|
@ -2276,15 +2276,11 @@ push_cold_blocks_to_end(cfg_builder *g) {
|
|||
if (!IS_LABEL(b->b_next->b_label)) {
|
||||
b->b_next->b_label.id = next_lbl++;
|
||||
}
|
||||
cfg_instr *prev_instr = basicblock_last_instr(b);
|
||||
// b cannot be empty because at the end of an exception handler
|
||||
// there is always a POP_EXCEPT + RERAISE/RETURN
|
||||
assert(prev_instr);
|
||||
|
||||
basicblock_addop(explicit_jump, JUMP_NO_INTERRUPT, b->b_next->b_label.id,
|
||||
prev_instr->i_loc);
|
||||
NO_LOCATION);
|
||||
explicit_jump->b_cold = 1;
|
||||
explicit_jump->b_next = b->b_next;
|
||||
explicit_jump->b_predecessors = 1;
|
||||
b->b_next = explicit_jump;
|
||||
|
||||
/* set target */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue