summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compile.py
diff options
context:
space:
mode:
authorBatuhan Taskaya <batuhan@python.org>2021-07-04 18:02:16 (GMT)
committerGitHub <noreply@github.com>2021-07-04 18:02:16 (GMT)
commit44f91fc802a2b71312e9abd9e8e9dcbf02e8216d (patch)
treea4ae2ed6dc8cb896efb695abb3a1c299f10e53e5 /Lib/test/test_compile.py
parentd33943a6c368c2184e238019c63ac7a267da5594 (diff)
downloadcpython-44f91fc802a2b71312e9abd9e8e9dcbf02e8216d.zip
cpython-44f91fc802a2b71312e9abd9e8e9dcbf02e8216d.tar.gz
cpython-44f91fc802a2b71312e9abd9e8e9dcbf02e8216d.tar.bz2
bpo-43950: use 0-indexed column offsets for bytecode positions (GH-27011)
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r--Lib/test/test_compile.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 47deda0..bc8c57d 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -1006,8 +1006,8 @@ class TestSourcePositions(unittest.TestCase):
return
lines.add(node.lineno)
end_lines.add(node.end_lineno)
- columns.add(node.col_offset + 1)
- end_columns.add(node.end_col_offset + 1)
+ columns.add(node.col_offset)
+ end_columns.add(node.end_col_offset)
SourceOffsetVisitor().visit(ast_tree)
@@ -1058,10 +1058,10 @@ class TestSourcePositions(unittest.TestCase):
self.assertOpcodeSourcePositionIs(compiled_code, 'INPLACE_SUBTRACT',
line=10_000 + 2, end_line=10_000 + 2,
- column=3, end_column=9)
+ column=2, end_column=8)
self.assertOpcodeSourcePositionIs(compiled_code, 'INPLACE_ADD',
line=10_000 + 4, end_line=10_000 + 4,
- column=3, end_column=10)
+ column=2, end_column=9)
def test_multiline_expression(self):
snippet = """\
@@ -1071,7 +1071,7 @@ f(
"""
compiled_code, _ = self.check_positions_against_ast(snippet)
self.assertOpcodeSourcePositionIs(compiled_code, 'CALL_FUNCTION',
- line=1, end_line=3, column=1, end_column=2)
+ line=1, end_line=3, column=0, end_column=1)
def test_very_long_line_end_offset(self):
# Make sure we get None for when the column offset is too large to
@@ -1088,15 +1088,15 @@ f(
compiled_code, _ = self.check_positions_against_ast(snippet)
self.assertOpcodeSourcePositionIs(compiled_code, 'BINARY_SUBSCR',
- line=1, end_line=1, column=14, end_column=22)
+ line=1, end_line=1, column=13, end_column=21)
self.assertOpcodeSourcePositionIs(compiled_code, 'BINARY_MULTIPLY',
- line=1, end_line=1, column=10, end_column=22)
+ line=1, end_line=1, column=9, end_column=21)
self.assertOpcodeSourcePositionIs(compiled_code, 'BINARY_ADD',
- line=1, end_line=1, column=10, end_column=27)
+ line=1, end_line=1, column=9, end_column=26)
self.assertOpcodeSourcePositionIs(compiled_code, 'BINARY_MATRIX_MULTIPLY',
- line=1, end_line=1, column=5, end_column=28)
+ line=1, end_line=1, column=4, end_column=27)
self.assertOpcodeSourcePositionIs(compiled_code, 'BINARY_SUBTRACT',
- line=1, end_line=1, column=1, end_column=28)
+ line=1, end_line=1, column=0, end_column=27)
class TestExpressionStackSize(unittest.TestCase):