summaryrefslogtreecommitdiffstats
path: root/Python
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
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')
-rw-r--r--Python/compile.c6
-rw-r--r--Python/importlib.h2
-rw-r--r--Python/importlib_external.h6
3 files changed, 10 insertions, 4 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 */
diff --git a/Python/importlib.h b/Python/importlib.h
index c5ff9ec..179f8df 100644
--- a/Python/importlib.h
+++ b/Python/importlib.h
@@ -1243,7 +1243,7 @@ const unsigned char _Py_M__importlib_bootstrap[] = {
114,32,109,111,100,117,108,101,32,99,114,101,97,116,105,111,
110,46,78,114,10,0,0,0,114,161,0,0,0,114,10,0,
0,0,114,10,0,0,0,114,11,0,0,0,114,150,0,0,
- 0,66,3,0,0,115,4,0,0,0,4,128,255,128,122,28,
+ 0,66,3,0,0,115,4,0,0,0,4,0,255,128,122,28,
70,114,111,122,101,110,73,109,112,111,114,116,101,114,46,99,
114,101,97,116,101,95,109,111,100,117,108,101,99,1,0,0,
0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,0,
diff --git a/Python/importlib_external.h b/Python/importlib_external.h
index c459bcf..8f18d20 100644
--- a/Python/importlib_external.h
+++ b/Python/importlib_external.h
@@ -1153,7 +1153,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = {
0,169,2,114,123,0,0,0,114,191,0,0,0,114,7,0,
0,0,114,7,0,0,0,114,8,0,0,0,218,13,99,114,
101,97,116,101,95,109,111,100,117,108,101,55,3,0,0,115,
- 4,0,0,0,4,128,255,128,122,27,95,76,111,97,100,101,
+ 4,0,0,0,4,0,255,128,122,27,95,76,111,97,100,101,
114,66,97,115,105,99,115,46,99,114,101,97,116,101,95,109,
111,100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,
0,0,3,0,0,0,5,0,0,0,67,0,0,0,115,56,
@@ -1292,7 +1292,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = {
32,32,32,78,114,7,0,0,0,41,3,114,123,0,0,0,
114,52,0,0,0,114,37,0,0,0,114,7,0,0,0,114,
7,0,0,0,114,8,0,0,0,114,232,0,0,0,105,3,
- 0,0,115,4,0,0,0,4,128,255,128,122,21,83,111,117,
+ 0,0,115,4,0,0,0,4,0,255,128,122,21,83,111,117,
114,99,101,76,111,97,100,101,114,46,115,101,116,95,100,97,
116,97,99,2,0,0,0,0,0,0,0,0,0,0,0,5,
0,0,0,10,0,0,0,67,0,0,0,115,70,0,0,0,
@@ -2019,7 +2019,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = {
0,115,4,0,0,0,100,1,83,0,114,217,0,0,0,114,
7,0,0,0,114,218,0,0,0,114,7,0,0,0,114,7,
0,0,0,114,8,0,0,0,114,219,0,0,0,217,4,0,
- 0,115,4,0,0,0,4,128,255,128,122,30,95,78,97,109,
+ 0,115,4,0,0,0,4,0,255,128,122,30,95,78,97,109,
101,115,112,97,99,101,76,111,97,100,101,114,46,99,114,101,
97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,0,
0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,