@@ -1622,8 +1622,9 @@ def testfunc(n):
16221622 self .assertEqual (uops .count ("_PUSH_FRAME" ), 2 )
16231623 # Type version propagation: one guard covers both method lookups
16241624 self .assertEqual (uops .count ("_GUARD_TYPE_VERSION" ), 1 )
1625- # Function checks cannot be eliminated for safety reasons.
1626- self .assertIn ("_CHECK_FUNCTION_VERSION" , uops )
1625+ # Function checks eliminated (type info resolves the callable)
1626+ self .assertNotIn ("_CHECK_FUNCTION_VERSION" , uops )
1627+ self .assertNotIn ("_CHECK_FUNCTION_EXACT_ARGS" , uops )
16271628
16281629 def test_method_chain_guard_elimination (self ):
16291630 """
@@ -1668,7 +1669,10 @@ def testfunc(n):
16681669 self .assertIsNotNone (ex )
16691670 uops = get_opnames (ex )
16701671 self .assertIn ("_PUSH_FRAME" , uops )
1671- self .assertIn ("_CHECK_FUNCTION_VERSION" , uops )
1672+ # Both should be not present, as this is a call
1673+ # to a simple function with a known function version.
1674+ self .assertNotIn ("_CHECK_FUNCTION_VERSION_INLINE" , uops )
1675+ self .assertNotIn ("_CHECK_FUNCTION_VERSION" , uops )
16721676 # Removed guard
16731677 self .assertNotIn ("_CHECK_FUNCTION_EXACT_ARGS" , uops )
16741678
@@ -5174,27 +5178,6 @@ def g():
51745178 PYTHON_JIT = "1" , PYTHON_JIT_STRESS = "1" )
51755179 self .assertEqual (result [0 ].rc , 0 , result )
51765180
5177- def test_func_version_guarded_on_change (self ):
5178- def testfunc (n ):
5179- for i in range (n ):
5180- # Only works on functions promoted to constants
5181- global_identity_code_will_be_modified (i )
5182-
5183- testfunc (TIER2_THRESHOLD )
5184-
5185- ex = get_first_executor (testfunc )
5186- self .assertIsNotNone (ex )
5187- uops = get_opnames (ex )
5188- self .assertIn ("_PUSH_FRAME" , uops )
5189- self .assertIn ("_CHECK_FUNCTION_VERSION" , uops )
5190-
5191- global_identity_code_will_be_modified .__code__ = (lambda a : 0xdeadead ).__code__
5192- _testinternalcapi .clear_executor_deletion_list ()
5193- ex = get_first_executor (testfunc )
5194- self .assertIsNone (ex )
5195- # JItted code should've deopted.
5196- self .assertEqual (global_identity_code_will_be_modified (None ), 0xdeadead )
5197-
51985181 def test_call_super (self ):
51995182 class A :
52005183 def method1 (self ):
@@ -5241,9 +5224,6 @@ def testfunc(n):
52415224def global_identity (x ):
52425225 return x
52435226
5244- def global_identity_code_will_be_modified (x ):
5245- return x
5246-
52475227class TestObject :
52485228 def test (self , * args , ** kwargs ):
52495229 return args [0 ]
0 commit comments