@@ -2431,6 +2431,54 @@ def gen():
2431
2431
next (gen ())
2432
2432
output .append (5 )
2433
2433
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
+
2434
2482
2435
2483
class TestExtendedArgs (unittest .TestCase ):
2436
2484
0 commit comments