@@ -4612,7 +4612,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4612
4612
4613
4613
// Check if the call can be inlined or not
4614
4614
PyObject * function = PEEK (oparg + 1 );
4615
- if (Py_TYPE (function ) == & PyFunction_Type ) {
4615
+ if (Py_TYPE (function ) == & PyFunction_Type && tstate -> interp -> eval_frame == NULL ) {
4616
4616
int code_flags = ((PyCodeObject * )PyFunction_GET_CODE (function ))-> co_flags ;
4617
4617
PyObject * locals = code_flags & CO_OPTIMIZED ? NULL : PyFunction_GET_GLOBALS (function );
4618
4618
int is_generator = code_flags & (CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR );
@@ -4630,7 +4630,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4630
4630
}
4631
4631
4632
4632
STACK_SHRINK (oparg + 1 );
4633
- assert (tstate -> interp -> eval_frame != NULL );
4634
4633
// The frame has stolen all the arguments from the stack,
4635
4634
// so there is no need to clean them up.
4636
4635
Py_DECREF (function );
@@ -5687,7 +5686,7 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, PyFrameConstructor *con,
5687
5686
if (steal_args ) {
5688
5687
// If we failed to initialize locals, make sure the caller still own all the
5689
5688
// 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).
5691
5690
PyCodeObject * co = (PyCodeObject * )con -> fc_code ;
5692
5691
const size_t total_args = co -> co_argcount + co -> co_kwonlyargcount ;
5693
5692
for (size_t i = 0 ; i < Py_MIN (argcount , total_args ); i ++ ) {
@@ -5734,7 +5733,6 @@ _PyEval_Vector(PyThreadState *tstate, PyFrameConstructor *con,
5734
5733
if (frame == NULL ) {
5735
5734
return NULL ;
5736
5735
}
5737
- assert (tstate -> interp -> eval_frame != NULL );
5738
5736
PyObject * retval = _PyEval_EvalFrame (tstate , frame , 0 );
5739
5737
assert (_PyFrame_GetStackPointer (frame ) == _PyFrame_Stackbase (frame ));
5740
5738
if (_PyEvalFrameClearAndPop (tstate , frame )) {
0 commit comments