@@ -4612,7 +4612,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
46124612
46134613 // Check if the call can be inlined or not
46144614 PyObject * function = PEEK (oparg + 1 );
4615- if (Py_TYPE (function ) == & PyFunction_Type ) {
4615+ if (Py_TYPE (function ) == & PyFunction_Type && tstate -> interp -> eval_frame == NULL ) {
46164616 int code_flags = ((PyCodeObject * )PyFunction_GET_CODE (function ))-> co_flags ;
46174617 PyObject * locals = code_flags & CO_OPTIMIZED ? NULL : PyFunction_GET_GLOBALS (function );
46184618 int is_generator = code_flags & (CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR );
@@ -4630,7 +4630,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
46304630 }
46314631
46324632 STACK_SHRINK (oparg + 1 );
4633- assert (tstate -> interp -> eval_frame != NULL );
46344633 // The frame has stolen all the arguments from the stack,
46354634 // so there is no need to clean them up.
46364635 Py_DECREF (function );
@@ -5687,7 +5686,7 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, PyFrameConstructor *con,
56875686 if (steal_args ) {
56885687 // If we failed to initialize locals, make sure the caller still own all the
56895688 // arguments. Notice that we only need to increase the reference count of the
5690- // *valid* arguments (i.e. the ones that fit into the frame).
5689+ // *valid* arguments (i.e. the ones that fit into the frame).
56915690 PyCodeObject * co = (PyCodeObject * )con -> fc_code ;
56925691 const size_t total_args = co -> co_argcount + co -> co_kwonlyargcount ;
56935692 for (size_t i = 0 ; i < Py_MIN (argcount , total_args ); i ++ ) {
@@ -5734,7 +5733,6 @@ _PyEval_Vector(PyThreadState *tstate, PyFrameConstructor *con,
57345733 if (frame == NULL ) {
57355734 return NULL ;
57365735 }
5737- assert (tstate -> interp -> eval_frame != NULL );
57385736 PyObject * retval = _PyEval_EvalFrame (tstate , frame , 0 );
57395737 assert (_PyFrame_GetStackPointer (frame ) == _PyFrame_Stackbase (frame ));
57405738 if (_PyEvalFrameClearAndPop (tstate , frame )) {
0 commit comments