@@ -2484,6 +2484,54 @@ def gen():
24842484 next (gen ())
24852485 output .append (5 )
24862486
2487+ @jump_test (2 , 3 , [1 , 3 ])
2488+ def test_jump_forward_over_listcomp (output ):
2489+ output .append (1 )
2490+ x = [i for i in range (10 )]
2491+ output .append (3 )
2492+
2493+ # checking for segfaults.
2494+ # See https://github.com/python/cpython/issues/92311
2495+ @jump_test (3 , 1 , [])
2496+ def test_jump_backward_over_listcomp (output ):
2497+ a = 1
2498+ x = [i for i in range (10 )]
2499+ c = 3
2500+
2501+ @jump_test (8 , 2 , [2 , 7 , 2 ])
2502+ def test_jump_backward_over_listcomp_v2 (output ):
2503+ flag = False
2504+ output .append (2 )
2505+ if flag :
2506+ return
2507+ x = [i for i in range (5 )]
2508+ flag = 6
2509+ output .append (7 )
2510+ output .append (8 )
2511+
2512+ @async_jump_test (2 , 3 , [1 , 3 ])
2513+ async def test_jump_forward_over_async_listcomp (output ):
2514+ output .append (1 )
2515+ x = [i async for i in asynciter (range (10 ))]
2516+ output .append (3 )
2517+
2518+ @async_jump_test (3 , 1 , [])
2519+ async def test_jump_backward_over_async_listcomp (output ):
2520+ a = 1
2521+ x = [i async for i in asynciter (range (10 ))]
2522+ c = 3
2523+
2524+ @async_jump_test (8 , 2 , [2 , 7 , 2 ])
2525+ async def test_jump_backward_over_async_listcomp_v2 (output ):
2526+ flag = False
2527+ output .append (2 )
2528+ if flag :
2529+ return
2530+ x = [i async for i in asynciter (range (5 ))]
2531+ flag = 6
2532+ output .append (7 )
2533+ output .append (8 )
2534+
24872535
24882536class TestExtendedArgs (unittest .TestCase ):
24892537
0 commit comments