| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -158,6 +158,18 @@ extern int _Py_HandlePending(PyThreadState *tstate); | |||
| 158 | 158 | ||
| 159 | 159 | extern PyObject * _PyEval_GetFrameLocals(void); | |
| 160 | 160 | ||
| 161 | + extern const binaryfunc _PyEval_BinaryOps[]; | ||
| 162 | + int _PyEval_CheckExceptStarTypeValid(PyThreadState *tstate, PyObject* right); | ||
| 163 | + int _PyEval_CheckExceptTypeValid(PyThreadState *tstate, PyObject* right); | ||
| 164 | + int _PyEval_ExceptionGroupMatch(PyObject* exc_value, PyObject *match_type, PyObject **match, PyObject **rest); | ||
| 165 | + void _PyEval_FormatAwaitableError(PyThreadState *tstate, PyTypeObject *type, int oparg); | ||
| 166 | + void _PyEval_FormatExcCheckArg(PyThreadState *tstate, PyObject *exc, const char *format_str, PyObject *obj); | ||
| 167 | + void _PyEval_FormatExcUnbound(PyThreadState *tstate, PyCodeObject *co, int oparg); | ||
| 168 | + void _PyEval_FormatKwargsError(PyThreadState *tstate, PyObject *func, PyObject *kwargs); | ||
| 169 | + PyObject *_PyEval_MatchClass(PyThreadState *tstate, PyObject *subject, PyObject *type, Py_ssize_t nargs, PyObject *kwargs); | ||
| 170 | + PyObject *_PyEval_MatchKeys(PyThreadState *tstate, PyObject *map, PyObject *keys); | ||
| 171 | + int _PyEval_UnpackIterable(PyThreadState *tstate, PyObject *v, int argcnt, int argcntafter, PyObject **sp); | ||
| 172 | + | ||
| 161 | 173 | ||
| 162 | 174 | #ifdef __cplusplus | |
| 163 | 175 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -381,6 +381,7 @@ PYTHON_OBJS= \ | |||
| 381 | 381 | Python/context.o \ | |
| 382 | 382 | Python/dynamic_annotations.o \ | |
| 383 | 383 | Python/errors.o \ | |
| 384 | + Python/executor.o \ | ||
| 384 | 385 | Python/flowgraph.o \ | |
| 385 | 386 | Python/frame.o \ | |
| 386 | 387 | Python/frozenmain.o \ | |
@@ -1562,10 +1563,13 @@ Python/ceval.o: \ | |||
| 1562 | 1563 | $(srcdir)/Python/ceval_macros.h \ | |
| 1563 | 1564 | $(srcdir)/Python/condvar.h \ | |
| 1564 | 1565 | $(srcdir)/Python/generated_cases.c.h \ | |
| 1565 | - $(srcdir)/Python/executor_cases.c.h \ | ||
| 1566 | - $(srcdir)/Include/internal/pycore_opcode_metadata.h \ | ||
| 1567 | 1566 | $(srcdir)/Python/opcode_targets.h | |
| 1568 | 1567 | ||
| 1568 | + Python/executor.o: \ | ||
| 1569 | + $(srcdir)/Include/internal/pycore_opcode_metadata.h \ | ||
| 1570 | + $(srcdir)/Python/ceval_macros.h \ | ||
| 1571 | + $(srcdir)/Python/executor_cases.c.h | ||
| 1572 | + | ||
| 1569 | 1573 | Python/flowgraph.o: \ | |
| 1570 | 1574 | $(srcdir)/Include/internal/pycore_opcode_metadata.h | |
| 1571 | 1575 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -192,6 +192,7 @@ | |||
| 192 | 192 | <ClCompile Include="..\Python\dynamic_annotations.c" /> | |
| 193 | 193 | <ClCompile Include="..\Python\dynload_win.c" /> | |
| 194 | 194 | <ClCompile Include="..\Python\errors.c" /> | |
| 195 | + <ClCompile Include="..\Python\executor.c" /> | ||
| 195 | 196 | <ClCompile Include="..\Python\fileutils.c" /> | |
| 196 | 197 | <ClCompile Include="..\Python\flowgraph.c" /> | |
| 197 | 198 | <ClCompile Include="..\Python\formatter_unicode.c" /> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,6 +124,9 @@ | |||
| 124 | 124 | <ClCompile Include="..\Python\errors.c"> | |
| 125 | 125 | <Filter>Source Files</Filter> | |
| 126 | 126 | </ClCompile> | |
| 127 | + <ClCompile Include="..\Python\executor.c"> | ||
| 128 | + <Filter>Source Files</Filter> | ||
| 129 | + </ClCompile> | ||
| 127 | 130 | <ClCompile Include="..\Objects\exceptions.c"> | |
| 128 | 131 | <Filter>Source Files</Filter> | |
| 129 | 132 | </ClCompile> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -520,6 +520,7 @@ | |||
| 520 | 520 | <ClCompile Include="..\Python\dynamic_annotations.c" /> | |
| 521 | 521 | <ClCompile Include="..\Python\dynload_win.c" /> | |
| 522 | 522 | <ClCompile Include="..\Python\errors.c" /> | |
| 523 | + <ClCompile Include="..\Python\executor.c" /> | ||
| 523 | 524 | <ClCompile Include="..\Python\fileutils.c" /> | |
| 524 | 525 | <ClCompile Include="..\Python\flowgraph.c" /> | |
| 525 | 526 | <ClCompile Include="..\Python\formatter_unicode.c" /> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1145,6 +1145,9 @@ | |||
| 1145 | 1145 | <ClCompile Include="..\Python\errors.c"> | |
| 1146 | 1146 | <Filter>Python</Filter> | |
| 1147 | 1147 | </ClCompile> | |
| 1148 | + <ClCompile Include="..\Python\executor.c"> | ||
| 1149 | + <Filter>Python</Filter> | ||
| 1150 | + </ClCompile> | ||
| 1148 | 1151 | <ClCompile Include="..\Python\fileutils.c"> | |
| 1149 | 1152 | <Filter>Python</Filter> | |
| 1150 | 1153 | </ClCompile> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,7 +77,6 @@ dummy_func( | |||
| 77 | 77 | PyObject **stack_pointer, | |
| 78 | 78 | PyObject *kwnames, | |
| 79 | 79 | int throwflag, | |
| 80 | - binaryfunc binary_ops[], | ||
| 81 | 80 | PyObject *args[] | |
| 82 | 81 | ) | |
| 83 | 82 | { | |
@@ -893,7 +892,7 @@ dummy_func( | |||
| 893 | 892 | iter = _PyCoro_GetAwaitableIter(iterable); | |
| 894 | 893 | ||
| 895 | 894 | if (iter == NULL) { | |
| 896 | - format_awaitable_error(tstate, Py_TYPE(iterable), oparg); | ||
| 895 | + _PyEval_FormatAwaitableError(tstate, Py_TYPE(iterable), oparg); | ||
| 897 | 896 | } | |
| 898 | 897 | ||
| 899 | 898 | DECREF_INPUTS(); | |
@@ -1120,9 +1119,9 @@ dummy_func( | |||
| 1120 | 1119 | err = PyObject_DelItem(ns, name); | |
| 1121 | 1120 | // Can't use ERROR_IF here. | |
| 1122 | 1121 | if (err != 0) { | |
| 1123 | - format_exc_check_arg(tstate, PyExc_NameError, | ||
| 1124 | - NAME_ERROR_MSG, | ||
| 1125 | - name); | ||
| 1122 | + _PyEval_FormatExcCheckArg(tstate, PyExc_NameError, | ||
| 1123 | + NAME_ERROR_MSG, | ||
| 1124 | + name); | ||
| 1126 | 1125 | goto error; | |
| 1127 | 1126 | } | |
| 1128 | 1127 | } | |
@@ -1145,7 +1144,7 @@ dummy_func( | |||
| 1145 | 1144 | DECREMENT_ADAPTIVE_COUNTER(cache->counter); | |
| 1146 | 1145 | #endif /* ENABLE_SPECIALIZATION */ | |
| 1147 | 1146 | PyObject **top = stack_pointer + oparg - 1; | |
| 1148 | - int res = unpack_iterable(tstate, seq, oparg, -1, top); | ||
| 1147 | + int res = _PyEval_UnpackIterable(tstate, seq, oparg, -1, top); | ||
| 1149 | 1148 | DECREF_INPUTS(); | |
| 1150 | 1149 | ERROR_IF(res == 0, error); | |
| 1151 | 1150 | } | |
@@ -1185,7 +1184,7 @@ dummy_func( | |||
| 1185 | 1184 | inst(UNPACK_EX, (seq -- unused[oparg & 0xFF], unused, unused[oparg >> 8])) { | |
| 1186 | 1185 | int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8); | |
| 1187 | 1186 | PyObject **top = stack_pointer + totalargs - 1; | |
| 1188 | - int res = unpack_iterable(tstate, seq, oparg & 0xFF, oparg >> 8, top); | ||
| 1187 | + int res = _PyEval_UnpackIterable(tstate, seq, oparg & 0xFF, oparg >> 8, top); | ||
| 1189 | 1188 | DECREF_INPUTS(); | |
| 1190 | 1189 | ERROR_IF(res == 0, error); | |
| 1191 | 1190 | } | |
@@ -1235,8 +1234,8 @@ dummy_func( | |||
| 1235 | 1234 | // Can't use ERROR_IF here. | |
| 1236 | 1235 | if (err != 0) { | |
| 1237 | 1236 | if (_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) { | |
| 1238 | - format_exc_check_arg(tstate, PyExc_NameError, | ||
| 1239 | - NAME_ERROR_MSG, name); | ||
| 1237 | + _PyEval_FormatExcCheckArg(tstate, PyExc_NameError, | ||
| 1238 | + NAME_ERROR_MSG, name); | ||
| 1240 | 1239 | } | |
| 1241 | 1240 | goto error; | |
| 1242 | 1241 | } | |
@@ -1274,7 +1273,7 @@ dummy_func( | |||
| 1274 | 1273 | goto error; | |
| 1275 | 1274 | } | |
| 1276 | 1275 | if (v == NULL) { | |
| 1277 | - format_exc_check_arg( | ||
| 1276 | + _PyEval_FormatExcCheckArg( | ||
| 1278 | 1277 | tstate, PyExc_NameError, | |
| 1279 | 1278 | NAME_ERROR_MSG, name); | |
| 1280 | 1279 | goto error; | |
@@ -1315,8 +1314,8 @@ dummy_func( | |||
| 1315 | 1314 | if (!_PyErr_Occurred(tstate)) { | |
| 1316 | 1315 | /* _PyDict_LoadGlobal() returns NULL without raising | |
| 1317 | 1316 | * an exception if the key doesn't exist */ | |
| 1318 | - format_exc_check_arg(tstate, PyExc_NameError, | ||
| 1319 | - NAME_ERROR_MSG, name); | ||
| 1317 | + _PyEval_FormatExcCheckArg(tstate, PyExc_NameError, | ||
| 1318 | + NAME_ERROR_MSG, name); | ||
| 1320 | 1319 | } | |
| 1321 | 1320 | ERROR_IF(true, error); | |
| 1322 | 1321 | } | |
@@ -1331,7 +1330,7 @@ dummy_func( | |||
| 1331 | 1330 | /* namespace 2: builtins */ | |
| 1332 | 1331 | ERROR_IF(PyMapping_GetOptionalItem(BUILTINS(), name, &v) < 0, error); | |
| 1333 | 1332 | if (v == NULL) { | |
| 1334 | - format_exc_check_arg( | ||
| 1333 | + _PyEval_FormatExcCheckArg( | ||
| 1335 | 1334 | tstate, PyExc_NameError, | |
| 1336 | 1335 | NAME_ERROR_MSG, name); | |
| 1337 | 1336 | ERROR_IF(true, error); | |
@@ -1413,7 +1412,7 @@ dummy_func( | |||
| 1413 | 1412 | // Can't use ERROR_IF here. | |
| 1414 | 1413 | // Fortunately we don't need its superpower. | |
| 1415 | 1414 | if (oldobj == NULL) { | |
| 1416 | - format_exc_unbound(tstate, _PyFrame_GetCode(frame), oparg); | ||
| 1415 | + _PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg); | ||
| 1417 | 1416 | goto error; | |
| 1418 | 1417 | } | |
| 1419 | 1418 | PyCell_SET(cell, NULL); | |
@@ -1434,7 +1433,7 @@ dummy_func( | |||
| 1434 | 1433 | PyObject *cell = GETLOCAL(oparg); | |
| 1435 | 1434 | value = PyCell_GET(cell); | |
| 1436 | 1435 | if (value == NULL) { | |
| 1437 | - format_exc_unbound(tstate, _PyFrame_GetCode(frame), oparg); | ||
| 1436 | + _PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg); | ||
| 1438 | 1437 | goto error; | |
| 1439 | 1438 | } | |
| 1440 | 1439 | Py_INCREF(value); | |
@@ -1445,7 +1444,7 @@ dummy_func( | |||
| 1445 | 1444 | PyObject *cell = GETLOCAL(oparg); | |
| 1446 | 1445 | value = PyCell_GET(cell); | |
| 1447 | 1446 | if (value == NULL) { | |
| 1448 | - format_exc_unbound(tstate, _PyFrame_GetCode(frame), oparg); | ||
| 1447 | + _PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg); | ||
| 1449 | 1448 | ERROR_IF(true, error); | |
| 1450 | 1449 | } | |
| 1451 | 1450 | Py_INCREF(value); | |
@@ -1612,7 +1611,7 @@ dummy_func( | |||
| 1612 | 1611 | PyObject *dict = PEEK(oparg + 1); // update is still on the stack | |
| 1613 | 1612 | ||
| 1614 | 1613 | if (_PyDict_MergeEx(dict, update, 2) < 0) { | |
| 1615 | - format_kwargs_error(tstate, PEEK(3 + oparg), update); | ||
| 1614 | + _PyEval_FormatKwargsError(tstate, PEEK(3 + oparg), update); | ||
| 1616 | 1615 | DECREF_INPUTS(); | |
| 1617 | 1616 | ERROR_IF(true, error); | |
| 1618 | 1617 | } | |
@@ -2126,15 +2125,15 @@ dummy_func( | |||
| 2126 | 2125 | } | |
| 2127 | 2126 | ||
| 2128 | 2127 | inst(CHECK_EG_MATCH, (exc_value, match_type -- rest, match)) { | |
| 2129 | - if (check_except_star_type_valid(tstate, match_type) < 0) { | ||
| 2128 | + if (_PyEval_CheckExceptStarTypeValid(tstate, match_type) < 0) { | ||
| 2130 | 2129 | DECREF_INPUTS(); | |
| 2131 | 2130 | ERROR_IF(true, error); | |
| 2132 | 2131 | } | |
| 2133 | 2132 | ||
| 2134 | 2133 | match = NULL; | |
| 2135 | 2134 | rest = NULL; | |
| 2136 | - int res = exception_group_match(exc_value, match_type, | ||
| 2137 | - &match, &rest); | ||
| 2135 | + int res = _PyEval_ExceptionGroupMatch(exc_value, match_type, | ||
| 2136 | + &match, &rest); | ||
| 2138 | 2137 | DECREF_INPUTS(); | |
| 2139 | 2138 | ERROR_IF(res < 0, error); | |
| 2140 | 2139 | ||
@@ -2148,7 +2147,7 @@ dummy_func( | |||
| 2148 | 2147 | ||
| 2149 | 2148 | inst(CHECK_EXC_MATCH, (left, right -- left, b)) { | |
| 2150 | 2149 | assert(PyExceptionInstance_Check(left)); | |
| 2151 | - if (check_except_type_valid(tstate, right) < 0) { | ||
| 2150 | + if (_PyEval_CheckExceptTypeValid(tstate, right) < 0) { | ||
| 2152 | 2151 | DECREF_INPUTS(); | |
| 2153 | 2152 | ERROR_IF(true, error); | |
| 2154 | 2153 | } | |
@@ -2275,7 +2274,7 @@ dummy_func( | |||
| 2275 | 2274 | // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or | |
| 2276 | 2275 | // None on failure. | |
| 2277 | 2276 | assert(PyTuple_CheckExact(names)); | |
| 2278 | - attrs = match_class(tstate, subject, type, oparg, names); | ||
| 2277 | + attrs = _PyEval_MatchClass(tstate, subject, type, oparg, names); | ||
| 2279 | 2278 | DECREF_INPUTS(); | |
| 2280 | 2279 | if (attrs) { | |
| 2281 | 2280 | assert(PyTuple_CheckExact(attrs)); // Success! | |
@@ -2298,7 +2297,7 @@ dummy_func( | |||
| 2298 | 2297 | ||
| 2299 | 2298 | inst(MATCH_KEYS, (subject, keys -- subject, keys, values_or_none)) { | |
| 2300 | 2299 | // On successful match, PUSH(values). Otherwise, PUSH(None). | |
| 2301 | - values_or_none = match_keys(tstate, subject, keys); | ||
| 2300 | + values_or_none = _PyEval_MatchKeys(tstate, subject, keys); | ||
| 2302 | 2301 | ERROR_IF(values_or_none == NULL, error); | |
| 2303 | 2302 | } | |
| 2304 | 2303 | ||
@@ -3617,10 +3616,10 @@ dummy_func( | |||
| 3617 | 3616 | STAT_INC(BINARY_OP, deferred); | |
| 3618 | 3617 | DECREMENT_ADAPTIVE_COUNTER(cache->counter); | |
| 3619 | 3618 | #endif /* ENABLE_SPECIALIZATION */ | |
| 3620 | - assert(0 <= oparg); | ||
| 3621 | - assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); | ||
| 3622 | - assert(binary_ops[oparg]); | ||
| 3623 | - res = binary_ops[oparg](lhs, rhs); | ||
| 3619 | + assert(NB_ADD <= oparg); | ||
| 3620 | + assert(oparg <= NB_INPLACE_XOR); | ||
| 3621 | + assert(_PyEval_BinaryOps[oparg]); | ||
| 3622 | + res = _PyEval_BinaryOps[oparg](lhs, rhs); | ||
| 3624 | 3623 | DECREF_INPUTS(); | |
| 3625 | 3624 | ERROR_IF(res == NULL, error); | |
| 3626 | 3625 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments