@@ -86,7 +86,9 @@ def _classify_stack(stack, jit_enabled):
8686def _annotate_unwind ():
8787 stack = _build_stack_and_unwind ()
8888 jit_enabled = hasattr (sys , "_jit" ) and sys ._jit .is_enabled ()
89+ jit_backend = _testinternalcapi .get_jit_backend ()
8990 ranges = _testinternalcapi .get_jit_code_ranges () if jit_enabled else []
91+ jit_code_ranges = len (ranges )
9092 if jit_enabled and ranges :
9193 print ("JIT ranges:" )
9294 for start , end in ranges :
@@ -101,6 +103,8 @@ def _annotate_unwind():
101103 "python_frames" : python_frames ,
102104 "jit_frames" : jit_frames ,
103105 "other_frames" : other_frames ,
106+ "jit_code_ranges" : jit_code_ranges ,
107+ "jit_backend" : jit_backend ,
104108 })
105109
106110
@@ -163,18 +167,27 @@ def test_manual_unwind_respects_frame_pointers(self):
163167 result = _manual_unwind_length (** env )
164168 jit_frames = result ["jit_frames" ]
165169 python_frames = result .get ("python_frames" , 0 )
170+ jit_backend = result .get ("jit_backend" )
166171 if self .frame_pointers_expected :
167172 self .assertGreater (
168173 python_frames ,
169174 0 ,
170175 f"expected to find Python frames on { self .machine } with env { env } " ,
171176 )
172177 if using_jit :
173- self .assertGreater (
174- jit_frames ,
175- 0 ,
176- f"expected to find JIT frames on { self .machine } with env { env } " ,
177- )
178+ if jit_backend == "jit" :
179+ self .assertGreater (
180+ jit_frames ,
181+ 0 ,
182+ f"expected to find JIT frames on { self .machine } with env { env } " ,
183+ )
184+ else :
185+ # jit_backend is "interpreter" or not present
186+ self .assertEqual (
187+ jit_frames ,
188+ 0 ,
189+ f"unexpected JIT frames counted on { self .machine } with env { env } " ,
190+ )
178191 else :
179192 self .assertEqual (
180193 jit_frames ,
0 commit comments