diff --git a/Python/bytecodes.c b/Python/bytecodes.c index ec57c07104d239..a2cd51b6f566f5 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -3567,6 +3567,8 @@ dummy_func( PyFunctionObject *init = (PyFunctionObject *)cls->_spec_cache.init; PyCodeObject *code = (PyCodeObject *)init->func_code; DEOPT_IF(code->co_argcount != oparg+1); + DEOPT_IF((code->co_flags & (CO_VARKEYWORDS | CO_VARARGS | CO_OPTIMIZED)) != CO_OPTIMIZED); + DEOPT_IF(code->co_kwonlyargcount); DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize + _Py_InitCleanup.co_framesize)); STAT_INC(CALL, hit); PyObject *self = _PyType_NewManagedObject(tp); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index b6463b878c1d5e..e17d0b155256f0 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -996,7 +996,8 @@ PyFunctionObject *init = (PyFunctionObject *)cls->_spec_cache.init; PyCodeObject *code = (PyCodeObject *)init->func_code; DEOPT_IF(code->co_argcount != oparg+1, CALL); - DEOPT_IF(_Py_Specialize_CheckCode(code) != _Py_Specialize_Ok, CALL); + DEOPT_IF((code->co_flags & (CO_VARKEYWORDS | CO_VARARGS | CO_OPTIMIZED)) != CO_OPTIMIZED, CALL); + DEOPT_IF(code->co_kwonlyargcount, CALL); DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize + _Py_InitCleanup.co_framesize), CALL); STAT_INC(CALL, hit); PyObject *self = _PyType_NewManagedObject(tp);