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
Rename labels and variable for clarity.
  • Loading branch information
markshannon committed Oct 14, 2021
commit 82f5093cbf5a5ed8535f92ce4218df831ec5af92
32 changes: 16 additions & 16 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
/* Variables used for making calls */
PyObject *kwnames;
int nargs;
int stackadj;
int postcall_shrink;

/* BEWARE!
It is essential that any operation that fails must goto error
Expand Down Expand Up @@ -4574,7 +4574,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
oparg += is_method;
nargs = oparg;
kwnames = NULL;
stackadj = 2-is_method;
postcall_shrink = 2-is_method;
goto call_function;
}

Expand All @@ -4585,14 +4585,14 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
int is_method = (PEEK(oparg + 2) != NULL);
oparg += is_method;
nargs = oparg - (int)PyTuple_GET_SIZE(kwnames);
stackadj = 2-is_method;
postcall_shrink = 2-is_method;
goto call_function;
}

TARGET(CALL_FUNCTION_KW) {
kwnames = POP();
nargs = oparg - (int)PyTuple_GET_SIZE(kwnames);
stackadj = 1;
postcall_shrink = 1;
goto call_function;
}

Expand All @@ -4601,7 +4601,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
PyObject *function;
nargs = oparg;
kwnames = NULL;
stackadj = 1;
postcall_shrink = 1;
call_function:
// Check if the call can be inlined or not
function = PEEK(oparg + 1);
Expand All @@ -4615,7 +4615,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
tstate, PyFunction_AS_FRAME_CONSTRUCTOR(function), locals,
stack_pointer,
nargs, kwnames, 1);
STACK_SHRINK(stackadj);
STACK_SHRINK(postcall_shrink);
// The frame has stolen all the arguments from the stack,
// so there is no need to clean them up.
Py_XDECREF(kwnames);
Expand All @@ -4629,8 +4629,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
goto start_frame;
}
}
PyObject *res;
/* Callable is not a normal Python function */
PyObject *res;
if (cframe.use_tracing) {
res = trace_call_function(tstate, function, stack_pointer-oparg, nargs, kwnames);
}
Expand All @@ -4646,7 +4646,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
for (int i = 0; i < oparg; i++) {
Py_DECREF(stack_pointer[i]);
}
STACK_SHRINK(stackadj);
STACK_SHRINK(postcall_shrink);
PUSH(res);
if (res == NULL) {
goto error;
Expand Down Expand Up @@ -5393,7 +5393,7 @@ initialize_locals(PyThreadState *tstate, PyFrameConstructor *con,
if (co->co_flags & CO_VARKEYWORDS) {
kwdict = PyDict_New();
if (kwdict == NULL) {
goto fail_early;
goto fail_pre_positional;
}
i = total_args;
if (co->co_flags & CO_VARARGS) {
Expand Down Expand Up @@ -5516,7 +5516,7 @@ initialize_locals(PyThreadState *tstate, PyFrameConstructor *con,
Py_DECREF(value);
}
}
goto fail_late;
goto fail_noclean;

kw_found:
if (localsplus[j] != NULL) {
Expand All @@ -5536,7 +5536,7 @@ initialize_locals(PyThreadState *tstate, PyFrameConstructor *con,
if ((argcount > co->co_argcount) && !(co->co_flags & CO_VARARGS)) {
too_many_positional(tstate, co, argcount, con->fc_defaults, localsplus,
con->fc_qualname);
goto fail_late;
goto fail_noclean;
}

/* Add missing positional arguments (copy default values from defs) */
Expand All @@ -5552,7 +5552,7 @@ initialize_locals(PyThreadState *tstate, PyFrameConstructor *con,
if (missing) {
missing_arguments(tstate, co, missing, defcount, localsplus,
con->fc_qualname);
goto fail_late;
goto fail_noclean;
}
if (n > m)
i = n - m;
Expand Down Expand Up @@ -5585,15 +5585,15 @@ initialize_locals(PyThreadState *tstate, PyFrameConstructor *con,
continue;
}
else if (_PyErr_Occurred(tstate)) {
goto fail_late;
goto fail_noclean;
}
}
missing++;
}
if (missing) {
missing_arguments(tstate, co, missing, -1, localsplus,
con->fc_qualname);
goto fail_late;
goto fail_noclean;
}
}

Expand All @@ -5606,7 +5606,7 @@ initialize_locals(PyThreadState *tstate, PyFrameConstructor *con,

return 0;

fail_early:
fail_pre_positional:
if (steal_args) {
for (j = 0; j < argcount; j++) {
Py_DECREF(args[j]);
Expand All @@ -5621,7 +5621,7 @@ initialize_locals(PyThreadState *tstate, PyFrameConstructor *con,
}
}
/* fall through */
fail_late:
fail_noclean:
return -1;
}

Expand Down