mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-92619: Fix bug where the compiler duplicates exit blocks unnecessarily (GH-92620)
This commit is contained in:
parent
eef47d5bc7
commit
7c6b7ade8d
3 changed files with 17 additions and 16 deletions
|
@ -9280,7 +9280,15 @@ trim_unused_consts(struct compiler *c, struct assembler *a, PyObject *consts)
|
|||
|
||||
static inline int
|
||||
is_exit_without_lineno(basicblock *b) {
|
||||
return b->b_exit && b->b_instr[0].i_lineno < 0;
|
||||
if (!b->b_exit) {
|
||||
return 0;
|
||||
}
|
||||
for (int i = 0; i < b->b_iused; i++) {
|
||||
if (b->b_instr[i].i_lineno >= 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* PEP 626 mandates that the f_lineno of a frame is correct
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue