@@ -2258,6 +2258,54 @@ def gen():
2258
2258
yield 3
2259
2259
next (gen ())
2260
2260
output .append (5 )
2261
+
2262
+ @jump_test (2 , 3 , [1 , 3 ])
2263
+ def test_jump_forward_over_listcomp (output ):
2264
+ output .append (1 )
2265
+ x = [i for i in range (10 )]
2266
+ output .append (3 )
2267
+
2268
+ # checking for segfaults.
2269
+ # See https://github.com/python/cpython/issues/92311
2270
+ @jump_test (3 , 1 , [])
2271
+ def test_jump_backward_over_listcomp (output ):
2272
+ a = 1
2273
+ x = [i for i in range (10 )]
2274
+ c = 3
2275
+
2276
+ @jump_test (8 , 2 , [2 , 7 , 2 ])
2277
+ def test_jump_backward_over_listcomp_v2 (output ):
2278
+ flag = False
2279
+ output .append (2 )
2280
+ if flag :
2281
+ return
2282
+ x = [i for i in range (5 )]
2283
+ flag = 6
2284
+ output .append (7 )
2285
+ output .append (8 )
2286
+
2287
+ @async_jump_test (2 , 3 , [1 , 3 ])
2288
+ async def test_jump_forward_over_async_listcomp (output ):
2289
+ output .append (1 )
2290
+ x = [i async for i in asynciter (range (10 ))]
2291
+ output .append (3 )
2292
+
2293
+ @async_jump_test (3 , 1 , [])
2294
+ async def test_jump_backward_over_async_listcomp (output ):
2295
+ a = 1
2296
+ x = [i async for i in asynciter (range (10 ))]
2297
+ c = 3
2298
+
2299
+ @async_jump_test (8 , 2 , [2 , 7 , 2 ])
2300
+ async def test_jump_backward_over_async_listcomp_v2 (output ):
2301
+ flag = False
2302
+ output .append (2 )
2303
+ if flag :
2304
+ return
2305
+ x = [i async for i in asynciter (range (5 ))]
2306
+ flag = 6
2307
+ output .append (7 )
2308
+ output .append (8 )
2261
2309
2262
2310
2263
2311
if __name__ == "__main__" :
0 commit comments