summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-12-04 15:22:12 (GMT)
committerGitHub <noreply@github.com>2020-12-04 15:22:12 (GMT)
commiteaccc12aa986f92ea05f3f0a63cedbff78dd67f1 (patch)
tree54ae6776ec2e1f1bf133200329bd16f2536577db /Python/compile.c
parentf24b8101a01fa98b1e3ec042ba896aeb4c24d4bc (diff)
downloadcpython-eaccc12aa986f92ea05f3f0a63cedbff78dd67f1.zip
cpython-eaccc12aa986f92ea05f3f0a63cedbff78dd67f1.tar.gz
cpython-eaccc12aa986f92ea05f3f0a63cedbff78dd67f1.tar.bz2
bpo-42246: Don't forget the entry block when ensuring that all exits have a line number (GH-23636)
Don't forget the entry block when ensuring that all exits have a line number.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index c67e8e8..ea9d678 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -6514,6 +6514,7 @@ is_exit_without_lineno(basicblock *b) {
static int
ensure_exits_have_lineno(struct compiler *c)
{
+ basicblock *entry = NULL;
/* Copy all exit blocks without line number that are targets of a jump.
*/
for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) {
@@ -6535,6 +6536,11 @@ ensure_exits_have_lineno(struct compiler *c)
b->b_instr[b->b_iused-1].i_target = new_target;
}
}
+ entry = b;
+ }
+ assert(entry != NULL);
+ if (is_exit_without_lineno(entry)) {
+ entry->b_instr[0].i_lineno = c->u->u_firstlineno;
}
/* Any remaining reachable exit blocks without line number can only be reached by
* fall through, and thus can only have a single predecessor */