@@ -2411,20 +2411,14 @@ def loop():
2411
2411
self .assertEqual (opt .get_count (), 1000 )
2412
2412
2413
2413
def test_long_loop (self ):
2414
- # Check that we aren't confused by EXTENDED_ARG
2414
+ " Check that we aren't confused by EXTENDED_ARG"
2415
2415
2416
2416
# Generate a new function at each call
2417
2417
ns = {}
2418
2418
exec (textwrap .dedent ("""
2419
2419
def nop():
2420
2420
pass
2421
2421
2422
- def short_loop():
2423
- for _ in range(10):
2424
- nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop();
2425
8000
- nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop();
2426
- nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop();
2427
-
2428
2422
def long_loop():
2429
2423
for _ in range(10):
2430
2424
nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop();
@@ -2435,21 +2429,14 @@ def long_loop():
2435
2429
nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop();
2436
2430
nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop();
2437
2431
""" ), ns , ns )
2438
- short_loop = ns ['short_loop' ]
2439
2432
long_loop = ns ['long_loop' ]
2440
2433
2441
2434
opt = _testinternalcapi .get_counter_optimizer ()
2442
2435
with temporary_optimizer (opt ):
2443
2436
self .assertEqual (opt .get_count (), 0 )
2444
- short_loop ()
2437
+ long_loop ()
2445
2438
self .assertEqual (opt .get_count (), 10 )
2446
2439
2447
- opt = _testinternalcapi .get_counter_optimizer ()
2448
- with temporary_optimizer (opt ):
2449
- self .assertEqual (opt .get_count (), 0 )
2450
- long_loop () # Should not optimize!
2451
- self .assertEqual (opt .get_count (), 0 )
2452
-
2453
2440
def test_code_restore_for_ENTER_EXECUTOR (self ):
2454
2441
def testfunc (x ):
2455
2442
i = 0
0 commit comments