mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +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
54
Python/generated_cases.c.h
generated
54
Python/generated_cases.c.h
generated
|
@ -1068,7 +1068,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);
|
||||
|
@ -1336,9 +1336,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;
|
||||
}
|
||||
DISPATCH();
|
||||
|
@ -1359,7 +1359,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);
|
||||
|
@ -1422,7 +1422,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));
|
||||
|
@ -1482,8 +1482,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;
|
||||
}
|
||||
|
@ -1543,7 +1543,7 @@
|
|||
goto error;
|
||||
}
|
||||
if (v == NULL) {
|
||||
format_exc_check_arg(
|
||||
_PyEval_FormatExcCheckArg(
|
||||
tstate, PyExc_NameError,
|
||||
NAME_ERROR_MSG, name);
|
||||
goto error;
|
||||
|
@ -1581,7 +1581,7 @@
|
|||
goto error;
|
||||
}
|
||||
if (v == NULL) {
|
||||
format_exc_check_arg(
|
||||
_PyEval_FormatExcCheckArg(
|
||||
tstate, PyExc_NameError,
|
||||
NAME_ERROR_MSG, name);
|
||||
goto error;
|
||||
|
@ -1621,8 +1621,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;
|
||||
}
|
||||
|
@ -1637,7 +1637,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;
|
||||
|
@ -1755,7 +1755,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);
|
||||
|
@ -1779,7 +1779,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);
|
||||
|
@ -1793,7 +1793,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);
|
||||
|
@ -2023,7 +2023,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;
|
||||
}
|
||||
|
@ -2679,7 +2679,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;
|
||||
|
@ -2687,8 +2687,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;
|
||||
|
@ -2709,7 +2709,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;
|
||||
}
|
||||
|
@ -2890,7 +2890,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);
|
||||
|
@ -2931,7 +2931,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;
|
||||
|
@ -4464,10 +4464,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