aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/flowgraph.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2024-06-07 22:37:35 +0100
committerGitHub <noreply@github.com>2024-06-07 22:37:35 +0100
commit4fc82b6d3b99f873179937215833e7a573ca7876 (patch)
treecad1fe09a3cf3444780a315d1bf6b039e810c7d0 /Python/flowgraph.c
parente6076d1e1303c3cc14bc02baf607535af2cf1501 (diff)
downloadcpython-4fc82b6d3b99f873179937215833e7a573ca7876.tar.gz
cpython-4fc82b6d3b99f873179937215833e7a573ca7876.zip
gh-120225: fix crash in compiler on empty block at end of exception handler (#120235)
Diffstat (limited to 'Python/flowgraph.c')
-rw-r--r--Python/flowgraph.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/Python/flowgraph.c b/Python/flowgraph.c
index 17617e119fd..aed694aee91 100644
--- a/Python/flowgraph.c
+++ b/Python/flowgraph.c
@@ -2304,15 +2304,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 */