[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 324d01944d)
This commit is contained in:
Łukasz Langa 2022-07-05 16:01:24 +02:00 committed by GitHub
parent 0615e7f9bb
commit 1bfe83a114
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 25 deletions

View file

@ -161,7 +161,7 @@ if 1:
co = compile(s256, 'fn', 'exec')
self.assertEqual(co.co_firstlineno, 1)
lines = list(co.co_lines())
self.assertEqual(lines[0][2], None)
self.assertEqual(lines[0][2], 0)
self.assertEqual(lines[1][2], 257)
def test_literals_with_leading_zeroes(self):
@ -1054,6 +1054,8 @@ class TestSourcePositions(unittest.TestCase):
# Check against the positions in the code object.
for (line, end_line, col, end_col) in code.co_positions():
if line == 0:
continue # This is an artificial module-start line
# If the offset is not None (indicating missing data), ensure that
# it was part of one of the AST nodes.
if line is not None: