mirror of
https://github.com/python/cpython.git
synced 2025-07-12 22:05:16 +00:00
gh-92619: Fix bug where the compiler duplicates exit blocks unnecessarily (GH-92620) (GH-92621)
(cherry picked from commit 7c6b7ade8d
)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
parent
6546af31ee
commit
6a17cdebe9
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