summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compile.py
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 /Lib/test/test_compile.py
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 'Lib/test/test_compile.py')
-rw-r--r--Lib/test/test_compile.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 46b16e7..ab1685d 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -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):
@@ -1032,8 +1032,8 @@ if 1:
def check_op_count(func, op, expected):
actual = 0
for instr in dis.Bytecode(func):
- if instr.opname == op:
- actual += 1
+ if instr.opname == op:
+ actual += 1
self.assertEqual(actual, expected)
def load():
@@ -1090,6 +1090,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: