mirror of
https://github.com/python/cpython.git
synced 2025-09-08 01:41:19 +00:00
[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:
parent
0615e7f9bb
commit
1bfe83a114
7 changed files with 32 additions and 25 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue