summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorƁukasz Langa <lukasz@langa.pl>2022-07-05 14:01:24 (GMT)
committerGitHub <noreply@github.com>2022-07-05 14:01:24 (GMT)
commit1bfe83a114da3939c00746fc44dc5da7f56f525f (patch)
tree8ac7429e794740f0748de56a1541df3f5357d70b /Python
parent0615e7f9bbc0ba07f48582df7857122d3f4c82b0 (diff)
downloadcpython-1bfe83a114da3939c00746fc44dc5da7f56f525f.zip
cpython-1bfe83a114da3939c00746fc44dc5da7f56f525f.tar.gz
cpython-1bfe83a114da3939c00746fc44dc5da7f56f525f.tar.bz2
[3.11] gh-94485: Set line number of module's RESUME instruction to 0 as specified by PEP 626 (GH-94552) (GH-94562)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Mark Shannon <mark@hotpy.org> (cherry picked from commit 324d01944d16868b07df9e8eef6987766a31a36d)
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 1bb0d96..cfe4b6e 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1803,7 +1803,7 @@ compiler_enter_scope(struct compiler *c, identifier name,
c->u->u_curblock = block;
if (u->u_scope_type == COMPILER_SCOPE_MODULE) {
- c->u->u_lineno = -1;
+ c->u->u_lineno = 0;
}
else {
if (!compiler_set_qualname(c))
@@ -1811,6 +1811,9 @@ compiler_enter_scope(struct compiler *c, identifier name,
}
ADDOP_I(c, RESUME, 0);
+ if (u->u_scope_type == COMPILER_SCOPE_MODULE) {
+ c->u->u_lineno = -1;
+ }
return 1;
}