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>
This commit is contained in:
Irit Katriel 2022-07-05 13:38:44 +01:00 committed by GitHub
parent a2a3f2c541
commit 324d01944d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 26 deletions

View file

@ -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;
}