summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-07-05 12:38:44 (GMT)
committerGitHub <noreply@github.com>2022-07-05 12:38:44 (GMT)
commit324d01944d16868b07df9e8eef6987766a31a36d (patch)
tree8162971b60cfa1d724a1c87d7913cf6c2170081a /Python/compile.c
parenta2a3f2c541290fc8f0720d1abdc12d564b856c28 (diff)
downloadcpython-324d01944d16868b07df9e8eef6987766a31a36d.zip
cpython-324d01944d16868b07df9e8eef6987766a31a36d.tar.gz
cpython-324d01944d16868b07df9e8eef6987766a31a36d.tar.bz2
gh-94485: Set line number of module's RESUME instruction to 0, as specified by PEP 626 (GH-94552)
Co-authored-by: Mark Shannon <mark@hotpy.org>
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 5ae1e34..7717689 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1759,7 +1759,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_loc.lineno = -1;
+ c->u->u_loc.lineno = 0;
}
else {
if (!compiler_set_qualname(c))
@@ -1767,6 +1767,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_loc.lineno = -1;
+ }
return 1;
}