@@ -2446,13 +2446,7 @@ def testfunc(x):
2446
2446
with temporary_optimizer (opt ):
2447
2447
testfunc (1000 )
2448
2448
2449
- ex = None
2450
- for offset in range (0 , len (testfunc .__code__ .co_code ), 2 ):
2451
- try :
2452
- ex = _testinternalcapi .get_executor (testfunc .__code__ , offset )
2453
- break
2454
- except ValueError :
2455
- pass
2449
+ ex = get_first_executor (testfunc .__code__ )
2456
2450
self .assertIsNotNone (ex )
2457
2451
uops = {opname for opname , _ in ex }
2458
2452
self .assertIn ("SAVE_IP" , uops )
@@ -2496,8 +2490,10 @@ def many_vars():
2496
2490
ex = get_first_executor (many_vars .__code__ )
2497
2491
self .assertIsNone (ex )
2498
2492
many_vars ()
2499
- ex = get_first_executor (many_vars .__code__ )
2500
- self .assertIn (("LOAD_FAST" , 259 ), list (ex ))
2493
+
2494
+ ex = get_first_executor (many_vars .__code__ )
2495
+ self .assertIsNotNone (ex )
2496
+ self .assertIn (("LOAD_FAST" , 259 ), list (ex ))
2501
2497
2502
2498
def test_unspecialized_unpack (self ):
2503
2499
# An example of an unspecialized opcode
@@ -2516,13 +2512,7 @@ def testfunc(x):
2516
2512
with temporary_optimizer (opt ):
2517
2513
testfunc (10 )
2518
2514
2519
- ex = None
2520
- for offset in range (0 , len (testfunc .__code__ .co_code ), 2 ):
2521
- try :
2522
- ex = _testinternalcapi .get_executor (testfunc .__code__ , offset )
2523
- break
2524
- except ValueError :
2525
- pass
2515
+ ex = get_first_executor (testfunc .__code__ )
2526
2516
self .assertIsNotNone (ex )
2527
2517
uops = {opname for opname , _ in ex }
2528
2518
self .assertIn ("UNPACK_SEQUENCE" , uops )
0 commit comments