Skip to content

[3.11] gh-92311: Add tests for frame_setlineno jumping over listcomps (GH-92741) #92797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions Lib/test/test_sys_settrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -2484,6 +2484,54 @@ def gen():
next(gen())
output.append(5)

@jump_test(2, 3, [1, 3])
def test_jump_forward_over_listcomp(output):
output.append(1)
x = [i for i in range(10)]
output.append(3)

# checking for segfaults.
# See https://github.com/python/cpython/issues/92311
@jump_test(3, 1, [])
def test_jump_backward_over_listcomp(output):
a = 1
x = [i for i in range(10)]
c = 3

@jump_test(8, 2, [2, 7, 2])
def test_jump_backward_over_listcomp_v2(output):
flag = False
output.append(2)
if flag:
return
x = [i for i in range(5)]
flag = 6
output.append(7)
output.append(8)

@async_jump_test(2, 3, [1, 3])
async def test_jump_forward_over_async_listcomp(output):
output.append(1)
x = [i async for i in asynciter(range(10))]
output.append(3)

@async_jump_test(3, 1, [])
async def test_jump_backward_over_async_listcomp(output):
a = 1
x = [i async for i in asynciter(range(10))]
c = 3

@async_jump_test(8, 2, [2, 7, 2])
async def test_jump_backward_over_async_listcomp_v2(output):
flag = False
output.append(2)
if flag:
return
x = [i async for i in asynciter(range(5))]
flag = 6
output.append(7)
output.append(8)


class TestExtendedArgs(unittest.TestCase):

Expand Down