diff options
author | Mark Shannon <mark@hotpy.org> | 2021-01-05 12:04:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-05 12:04:10 (GMT) |
commit | ee9f98d9f4b881ee15868a836a2b99271df1bc0e (patch) | |
tree | 5f5a6b4cc99c86d7ee99cf0c8287cf601abd99a7 /Python/compile.c | |
parent | e40e2a2cc94c554e7e245a8ca5a7432d31a95766 (diff) | |
download | cpython-ee9f98d9f4b881ee15868a836a2b99271df1bc0e.zip cpython-ee9f98d9f4b881ee15868a836a2b99271df1bc0e.tar.gz cpython-ee9f98d9f4b881ee15868a836a2b99271df1bc0e.tar.bz2 |
bpo-42823: Fix frame lineno when frame.f_trace is set (GH-24099)
* Add test for frame.f_lineno with/without tracing.
* Make sure that frame.f_lineno is correct regardless of whether frame.f_trace is set.
* Update importlib
* Add NEWS
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c index ddeb666..cf5c639 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -6558,6 +6558,12 @@ ensure_exits_have_lineno(struct compiler *c) if (is_exit_without_lineno(entry)) { entry->b_instr[0].i_lineno = c->u->u_firstlineno; } + /* Eliminate empty blocks */ + for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) { + while (b->b_next && b->b_next->b_iused == 0) { + b->b_next = b->b_next->b_next; + } + } /* Any remaining reachable exit blocks without line number can only be reached by * fall through, and thus can only have a single predecessor */ for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) { |