Visitar URL original
gh-98003: Inline call frames for CALL_FUNCTION_EX by Fidget-Spinner · Pull Request #98004 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
re-order STACK_SHRINK to fix error case
  • Loading branch information
Fidget-Spinner committed Oct 6, 2022
commit 92fead82dbf0680eeacaa970aed957a892e97d31
4 changes: 2 additions & 2 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -4838,7 +4838,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
DEOPT_IF(!PyTuple_CheckExact(callargs), CALL_FUNCTION_EX);
Py_ssize_t nargs = PyTuple_GET_SIZE(callargs);
DEOPT_IF(!Py_IS_TYPE(func, &PyFunction_Type), CALL_FUNCTION_EX);
STACK_SHRINK(3);
STACK_SHRINK(3); /* Get rid of callargs, func and NULL */
STAT_INC(CALL_FUNCTION_EX, hit);

int code_flags = ((PyCodeObject *)PyFunction_GET_CODE(func))->co_flags;
Expand Down Expand Up @@ -4886,14 +4886,14 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
DEOPT_IF(kwargs != NULL &&
((PyDictObject *)kwargs)->ma_keys->dk_kind != DICT_KEYS_UNICODE, CALL_FUNCTION_EX);
STAT_INC(CALL_FUNCTION_EX, hit);
STACK_SHRINK(2 + has_kwargs); /* Get rid of kwargs, callargs, func */

// This is slower but CPython promises to check all non-vectorcall
// function calls.
if (_Py_EnterRecursiveCallTstate(tstate, " while calling a Python object")) {
goto error;
}

STACK_SHRINK(2 + has_kwargs); /* Get rid of kwargs, callargs, func */
/* res = func(self, args, nargs, kwnames) */
PyCFunction cfunc = PyCFunction_GET_FUNCTION(func);
PyObject *res = ((PyCFunctionWithKeywords)(void(*)(void))cfunc)(
Expand Down