mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
GH-106701: Move _PyUopExecute to Python/executor.c (GH-106924)
This commit is contained in:
parent
9c81fc2dbe
commit
8f4de57699
13 changed files with 276 additions and 247 deletions
52
Python/executor_cases.c.h
generated
52
Python/executor_cases.c.h
generated
|
@ -672,7 +672,7 @@
|
|||
iter = _PyCoro_GetAwaitableIter(iterable);
|
||||
|
||||
if (iter == NULL) {
|
||||
format_awaitable_error(tstate, Py_TYPE(iterable), oparg);
|
||||
_PyEval_FormatAwaitableError(tstate, Py_TYPE(iterable), oparg);
|
||||
}
|
||||
|
||||
Py_DECREF(iterable);
|
||||
|
@ -758,9 +758,9 @@
|
|||
err = PyObject_DelItem(ns, name);
|
||||
// Can't use ERROR_IF here.
|
||||
if (err != 0) {
|
||||
format_exc_check_arg(tstate, PyExc_NameError,
|
||||
NAME_ERROR_MSG,
|
||||
name);
|
||||
_PyEval_FormatExcCheckArg(tstate, PyExc_NameError,
|
||||
NAME_ERROR_MSG,
|
||||
name);
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
@ -780,7 +780,7 @@
|
|||
DECREMENT_ADAPTIVE_COUNTER(cache->counter);
|
||||
#endif /* ENABLE_SPECIALIZATION */
|
||||
PyObject **top = stack_pointer + oparg - 1;
|
||||
int res = unpack_iterable(tstate, seq, oparg, -1, top);
|
||||
int res = _PyEval_UnpackIterable(tstate, seq, oparg, -1, top);
|
||||
Py_DECREF(seq);
|
||||
if (res == 0) goto pop_1_error;
|
||||
STACK_SHRINK(1);
|
||||
|
@ -839,7 +839,7 @@
|
|||
PyObject *seq = stack_pointer[-1];
|
||||
int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8);
|
||||
PyObject **top = stack_pointer + totalargs - 1;
|
||||
int res = unpack_iterable(tstate, seq, oparg & 0xFF, oparg >> 8, top);
|
||||
int res = _PyEval_UnpackIterable(tstate, seq, oparg & 0xFF, oparg >> 8, top);
|
||||
Py_DECREF(seq);
|
||||
if (res == 0) goto pop_1_error;
|
||||
STACK_GROW((oparg & 0xFF) + (oparg >> 8));
|
||||
|
@ -897,8 +897,8 @@
|
|||
// Can't use ERROR_IF here.
|
||||
if (err != 0) {
|
||||
if (_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) {
|
||||
format_exc_check_arg(tstate, PyExc_NameError,
|
||||
NAME_ERROR_MSG, name);
|
||||
_PyEval_FormatExcCheckArg(tstate, PyExc_NameError,
|
||||
NAME_ERROR_MSG, name);
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
|
@ -941,7 +941,7 @@
|
|||
goto error;
|
||||
}
|
||||
if (v == NULL) {
|
||||
format_exc_check_arg(
|
||||
_PyEval_FormatExcCheckArg(
|
||||
tstate, PyExc_NameError,
|
||||
NAME_ERROR_MSG, name);
|
||||
goto error;
|
||||
|
@ -978,8 +978,8 @@
|
|||
if (!_PyErr_Occurred(tstate)) {
|
||||
/* _PyDict_LoadGlobal() returns NULL without raising
|
||||
* an exception if the key doesn't exist */
|
||||
format_exc_check_arg(tstate, PyExc_NameError,
|
||||
NAME_ERROR_MSG, name);
|
||||
_PyEval_FormatExcCheckArg(tstate, PyExc_NameError,
|
||||
NAME_ERROR_MSG, name);
|
||||
}
|
||||
if (true) goto error;
|
||||
}
|
||||
|
@ -994,7 +994,7 @@
|
|||
/* namespace 2: builtins */
|
||||
if (PyMapping_GetOptionalItem(BUILTINS(), name, &v) < 0) goto error;
|
||||
if (v == NULL) {
|
||||
format_exc_check_arg(
|
||||
_PyEval_FormatExcCheckArg(
|
||||
tstate, PyExc_NameError,
|
||||
NAME_ERROR_MSG, name);
|
||||
if (true) goto error;
|
||||
|
@ -1080,7 +1080,7 @@
|
|||
// Can't use ERROR_IF here.
|
||||
// Fortunately we don't need its superpower.
|
||||
if (oldobj == NULL) {
|
||||
format_exc_unbound(tstate, _PyFrame_GetCode(frame), oparg);
|
||||
_PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg);
|
||||
goto error;
|
||||
}
|
||||
PyCell_SET(cell, NULL);
|
||||
|
@ -1104,7 +1104,7 @@
|
|||
PyObject *cell = GETLOCAL(oparg);
|
||||
value = PyCell_GET(cell);
|
||||
if (value == NULL) {
|
||||
format_exc_unbound(tstate, _PyFrame_GetCode(frame), oparg);
|
||||
_PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg);
|
||||
goto error;
|
||||
}
|
||||
Py_INCREF(value);
|
||||
|
@ -1118,7 +1118,7 @@
|
|||
PyObject *cell = GETLOCAL(oparg);
|
||||
value = PyCell_GET(cell);
|
||||
if (value == NULL) {
|
||||
format_exc_unbound(tstate, _PyFrame_GetCode(frame), oparg);
|
||||
_PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg);
|
||||
if (true) goto error;
|
||||
}
|
||||
Py_INCREF(value);
|
||||
|
@ -1348,7 +1348,7 @@
|
|||
PyObject *dict = PEEK(oparg + 1); // update is still on the stack
|
||||
|
||||
if (_PyDict_MergeEx(dict, update, 2) < 0) {
|
||||
format_kwargs_error(tstate, PEEK(3 + oparg), update);
|
||||
_PyEval_FormatKwargsError(tstate, PEEK(3 + oparg), update);
|
||||
Py_DECREF(update);
|
||||
if (true) goto pop_1_error;
|
||||
}
|
||||
|
@ -1646,7 +1646,7 @@
|
|||
PyObject *exc_value = stack_pointer[-2];
|
||||
PyObject *rest;
|
||||
PyObject *match;
|
||||
if (check_except_star_type_valid(tstate, match_type) < 0) {
|
||||
if (_PyEval_CheckExceptStarTypeValid(tstate, match_type) < 0) {
|
||||
Py_DECREF(exc_value);
|
||||
Py_DECREF(match_type);
|
||||
if (true) goto pop_2_error;
|
||||
|
@ -1654,8 +1654,8 @@
|
|||
|
||||
match = NULL;
|
||||
rest = NULL;
|
||||
int res = exception_group_match(exc_value, match_type,
|
||||
&match, &rest);
|
||||
int res = _PyEval_ExceptionGroupMatch(exc_value, match_type,
|
||||
&match, &rest);
|
||||
Py_DECREF(exc_value);
|
||||
Py_DECREF(match_type);
|
||||
if (res < 0) goto pop_2_error;
|
||||
|
@ -1676,7 +1676,7 @@
|
|||
PyObject *left = stack_pointer[-2];
|
||||
PyObject *b;
|
||||
assert(PyExceptionInstance_Check(left));
|
||||
if (check_except_type_valid(tstate, right) < 0) {
|
||||
if (_PyEval_CheckExceptTypeValid(tstate, right) < 0) {
|
||||
Py_DECREF(right);
|
||||
if (true) goto pop_1_error;
|
||||
}
|
||||
|
@ -1723,7 +1723,7 @@
|
|||
// Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or
|
||||
// None on failure.
|
||||
assert(PyTuple_CheckExact(names));
|
||||
attrs = match_class(tstate, subject, type, oparg, names);
|
||||
attrs = _PyEval_MatchClass(tstate, subject, type, oparg, names);
|
||||
Py_DECREF(subject);
|
||||
Py_DECREF(type);
|
||||
Py_DECREF(names);
|
||||
|
@ -1764,7 +1764,7 @@
|
|||
PyObject *subject = stack_pointer[-2];
|
||||
PyObject *values_or_none;
|
||||
// On successful match, PUSH(values). Otherwise, PUSH(None).
|
||||
values_or_none = match_keys(tstate, subject, keys);
|
||||
values_or_none = _PyEval_MatchKeys(tstate, subject, keys);
|
||||
if (values_or_none == NULL) goto error;
|
||||
STACK_GROW(1);
|
||||
stack_pointer[-1] = values_or_none;
|
||||
|
@ -2462,10 +2462,10 @@
|
|||
STAT_INC(BINARY_OP, deferred);
|
||||
DECREMENT_ADAPTIVE_COUNTER(cache->counter);
|
||||
#endif /* ENABLE_SPECIALIZATION */
|
||||
assert(0 <= oparg);
|
||||
assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops));
|
||||
assert(binary_ops[oparg]);
|
||||
res = binary_ops[oparg](lhs, rhs);
|
||||
assert(NB_ADD <= oparg);
|
||||
assert(oparg <= NB_INPLACE_XOR);
|
||||
assert(_PyEval_BinaryOps[oparg]);
|
||||
res = _PyEval_BinaryOps[oparg](lhs, rhs);
|
||||
Py_DECREF(lhs);
|
||||
Py_DECREF(rhs);
|
||||
if (res == NULL) goto pop_2_error;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue