gh-123142: Fix too wide source locations in tracebacks of exceptions from broken iterables in comprehensions (#123173)

This commit is contained in:
Irit Katriel 2024-08-21 19:12:05 +01:00 committed by GitHub
parent a4fd7aa4a6
commit ec89620e5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 122 additions and 22 deletions

View file

@ -1172,7 +1172,7 @@ class TestSpecifics(unittest.TestCase):
x
in
y)
genexp_lines = [0, 2, 0]
genexp_lines = [0, 4, 2, 0, 4]
genexp_code = return_genexp.__code__.co_consts[1]
code_lines = self.get_code_lines(genexp_code)
@ -1627,7 +1627,7 @@ class TestSourcePositions(unittest.TestCase):
self.assertOpcodeSourcePositionIs(compiled_code, 'JUMP_BACKWARD',
line=1, end_line=2, column=1, end_column=8, occurrence=1)
self.assertOpcodeSourcePositionIs(compiled_code, 'RETURN_CONST',
line=1, end_line=6, column=0, end_column=32, occurrence=1)
line=4, end_line=4, column=7, end_column=14, occurrence=1)
def test_multiline_async_generator_expression(self):
snippet = textwrap.dedent("""\