Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8cf2906

Browse filesBrowse files
authored
gh-92311: Add tests for frame_setlineno jumping over listcomps (#92741)
1 parent 83c0247 commit 8cf2906
Copy full SHA for 8cf2906

File tree

Expand file treeCollapse file tree

1 file changed

+48
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+48
-0
lines changed

‎Lib/test/test_sys_settrace.py

Copy file name to clipboardExpand all lines: Lib/test/test_sys_settrace.py
+48Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,6 +2431,54 @@ def gen():
24312431
next(gen())
24322432
output.append(5)
24332433

2434+
@jump_test(2, 3, [1, 3])
2435+
def test_jump_forward_over_listcomp(output):
2436+
output.append(1)
2437+
x = [i for i in range(10)]
2438+
output.append(3)
2439+
2440+
# checking for segfaults.
2441+
# See https://github.com/python/cpython/issues/92311
2442+
@jump_test(3, 1, [])
2443+
def test_jump_backward_over_listcomp(output):
2444+
a = 1
2445+
x = [i for i in range(10)]
2446+
c = 3
2447+
2448+
@jump_test(8, 2, [2, 7, 2])
2449+
def test_jump_backward_over_listcomp_v2(output):
2450+
flag = False
2451+
output.append(2)
2452+
if flag:
2453+
return
2454+
x = [i for i in range(5)]
2455+
flag = 6
2456+
output.append(7)
2457+
output.append(8)
2458+
2459+
@async_jump_test(2, 3, [1, 3])
2460+
async def test_jump_forward_over_async_listcomp(output):
2461+
output.append(1)
2462+
x = [i async for i in asynciter(range(10))]
2463+
output.append(3)
2464+
2465+
@async_jump_test(3, 1, [])
2466+
async def test_jump_backward_over_async_listcomp(output):
2467+
a = 1
2468+
x = [i async for i in asynciter(range(10))]
2469+
c = 3
2470+
2471+
@async_jump_test(8, 2, [2, 7, 2])
2472+
async def test_jump_backward_over_async_listcomp_v2(output):
2473+
flag = False
2474+
output.append(2)
2475+
if flag:
2476+
return
2477+
x = [i async for i in asynciter(range(5))]
2478+
flag = 6
2479+
output.append(7)
2480+
output.append(8)
2481+
24342482

24352483
class TestExtendedArgs(unittest.TestCase):
24362484

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.