@@ -275,7 +275,8 @@ maybe_lltrace_resume_frame(_PyInterpreterFrame *frame, PyObject *globals)
275275 }
276276 int r = PyDict_Contains (globals , & _Py_ID (__lltrace__ ));
277277 if (r < 0 ) {
278- return -1 ;
278+ PyErr_Clear ();
279+ return 0 ;
279280 }
280281 int lltrace = r * 5 ; // Levels 1-4 only trace uops
281282 if (!lltrace ) {
@@ -1109,11 +1110,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
11091110#endif
11101111 }
11111112
1112- #if defined(_Py_TIER2 ) && !defined(_Py_JIT )
1113- /* Tier 2 interpreter state */
1114- _PyExecutorObject * current_executor = NULL ;
1115- const _PyUOpInstruction * next_uop = NULL ;
1116- #endif
11171113#if Py_TAIL_CALL_INTERP
11181114# if Py_STATS
11191115 return _TAIL_CALL_start_frame (frame , NULL , tstate , NULL , 0 , lastopcode );
@@ -1126,14 +1122,41 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
11261122#endif
11271123
11281124
1125+ early_exit :
1126+ assert (_PyErr_Occurred (tstate ));
1127+ _Py_LeaveRecursiveCallPy (tstate );
1128+ assert (frame -> owner != FRAME_OWNED_BY_INTERPRETER );
1129+ // GH-99729: We need to unlink the frame *before* clearing it:
1130+ _PyInterpreterFrame * dying = frame ;
1131+ frame = tstate -> current_frame = dying -> previous ;
1132+ _PyEval_FrameClearAndPop (tstate , dying );
1133+ frame -> return_offset = 0 ;
1134+ assert (frame -> owner == FRAME_OWNED_BY_INTERPRETER );
1135+ /* Restore previous frame and exit */
1136+ tstate -> current_frame = frame -> previous ;
1137+ return NULL ;
1138+ }
11291139#ifdef _Py_TIER2
1130-
1131- // Tier 2 is also here!
1132- enter_tier_two :
1133-
11341140#ifdef _Py_JIT
1135- assert ( 0 ) ;
1141+ _PyJitEntryFuncPtr _Py_jit_entry = _Py_LazyJitTrampoline ;
11361142#else
1143+ _PyJitEntryFuncPtr _Py_jit_entry = _PyTier2Interpreter ;
1144+ #endif
1145+ #endif
1146+
1147+ #if defined(_Py_TIER2 ) && !defined(_Py_JIT )
1148+
1149+ _Py_CODEUNIT *
1150+ _PyTier2Interpreter (
1151+ _PyExecutorObject * current_executor , _PyInterpreterFrame * frame ,
1152+ _PyStackRef * stack_pointer , PyThreadState * tstate
1153+ ) {
1154+ const _PyUOpInstruction * next_uop ;
1155+ int oparg ;
1156+ tier2_start :
1157+
1158+ next_uop = current_executor -> trace ;
1159+ assert (next_uop -> opcode == _START_EXECUTOR || next_uop -> opcode == _COLD_EXIT );
11371160
11381161#undef LOAD_IP
11391162#define LOAD_IP (UNUSED ) (void)0
@@ -1151,7 +1174,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
11511174#undef ENABLE_SPECIALIZATION_FT
11521175#define ENABLE_SPECIALIZATION_FT 0
11531176
1154- ; // dummy statement after a label, before a declaration
11551177 uint16_t uopcode ;
11561178#ifdef Py_STATS
11571179 int lastuop = 0 ;
@@ -1225,24 +1247,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
12251247 next_uop = current_executor -> trace + target ;
12261248 goto tier2_dispatch ;
12271249
1228- #endif // _Py_JIT
1229-
1250+ }
12301251#endif // _Py_TIER2
12311252
1232- early_exit :
1233- assert (_PyErr_Occurred (tstate ));
1234- _Py_LeaveRecursiveCallPy (tstate );
1235- assert (frame -> owner != FRAME_OWNED_BY_INTERPRETER );
1236- // GH-99729: We need to unlink the frame *before* clearing it:
1237- _PyInterpreterFrame * dying = frame ;
1238- frame = tstate -> current_frame = dying -> previous ;
1239- _PyEval_FrameClearAndPop (tstate , dying );
1240- frame -> return_offset = 0 ;
1241- assert (frame -> owner == FRAME_OWNED_BY_INTERPRETER );
1242- /* Restore previous frame and exit */
1243- tstate -> current_frame = frame -> previous ;
1244- return NULL ;
1245- }
12461253
12471254#ifdef DO_NOT_OPTIMIZE_INTERP_LOOP
12481255# pragma optimize("", on)
0 commit comments