File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -1570,25 +1570,22 @@ def test_init_resolves_callable(self):
15701570 """
15711571 class MyPoint :
15721572 def __init__ (self , x , y ):
1573- self .x = x
1574- self .y = y
1573+ # If __init__ callable is propagated through, then
1574+ # These will get promoted from globals to constants.
1575+ self .x = range (1 )
1576+ self .y = range (1 )
15751577
15761578 def testfunc (n ):
1577- total = 0.0
15781579 for _ in range (n ):
15791580 p = MyPoint (1.0 , 2.0 )
1580- total += p .x
1581- return total
15821581
1583- res , ex = self ._run_with_optimizer (testfunc , TIER2_THRESHOLD )
1584- self .assertAlmostEqual (res , TIER2_THRESHOLD * 1.0 )
1582+ _ , ex = self ._run_with_optimizer (testfunc , TIER2_THRESHOLD )
15851583 self .assertIsNotNone (ex )
15861584 uops = get_opnames (ex )
15871585 # The __init__ call should be traced through via _PUSH_FRAME
15881586 self .assertIn ("_PUSH_FRAME" , uops )
1589- # __init__ resolution eliminates function version and arg checks
1590- self .assertNotIn ("_CHECK_FUNCTION_VERSION" , uops )
1591- self .assertNotIn ("_CHECK_FUNCTION_EXACT_ARGS" , uops )
1587+ # __init__ resolution allows promotion of range to constant
1588+ self .assertNotIn ("_LOAD_GLOBAL_BUILTINS" , uops )
15921589
15931590 def test_guard_type_version_locked_propagates (self ):
15941591 """
You can’t perform that action at this time.
0 commit comments