diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2022-07-05 12:38:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 12:38:44 (GMT) |
commit | 324d01944d16868b07df9e8eef6987766a31a36d (patch) | |
tree | 8162971b60cfa1d724a1c87d7913cf6c2170081a /Python/compile.c | |
parent | a2a3f2c541290fc8f0720d1abdc12d564b856c28 (diff) | |
download | cpython-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.c | 5 |
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; } |