[3.12] gh-123142: Fix too wide source locations in tracebacks of exceptions from broken iterables in comprehensions (GH-123173). (#123210)

(cherry picked from commit ec89620e5e)
This commit is contained in:
Irit Katriel 2024-08-22 10:22:43 +01:00 committed by GitHub
parent 8edfa0b0b4
commit fbbde4dc6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 122 additions and 21 deletions

View file

@ -1065,7 +1065,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)
@ -1431,7 +1431,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("""\