summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index b61cc08..8891d6c 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3126,8 +3126,11 @@ handle_eval_breaker:
PyObject *getattribute = read_obj(cache->descr);
assert(Py_IS_TYPE(getattribute, &PyFunction_Type));
PyFunctionObject *f = (PyFunctionObject *)getattribute;
+ uint32_t func_version = read_u32(cache->keys_version);
+ assert(func_version != 0);
+ DEOPT_IF(f->func_version != func_version, LOAD_ATTR);
PyCodeObject *code = (PyCodeObject *)f->func_code;
- DEOPT_IF(((PyCodeObject *)f->func_code)->co_argcount != 2, LOAD_ATTR);
+ assert(code->co_argcount == 2);
DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize), CALL);
STAT_INC(LOAD_ATTR, hit);
@@ -4133,7 +4136,10 @@ handle_eval_breaker:
function = PEEK(total_args + 1);
int positional_args = total_args - KWNAMES_LEN();
// Check if the call can be inlined or not
- if (Py_TYPE(function) == &PyFunction_Type && tstate->interp->eval_frame == NULL) {
+ if (Py_TYPE(function) == &PyFunction_Type &&
+ tstate->interp->eval_frame == NULL &&
+ ((PyFunctionObject *)function)->vectorcall == _PyFunction_Vectorcall)
+ {
int code_flags = ((PyCodeObject*)PyFunction_GET_CODE(function))->co_flags;
PyObject *locals = code_flags & CO_OPTIMIZED ? NULL : Py_NewRef(PyFunction_GET_GLOBALS(function));
STACK_SHRINK(total_args);