diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-03-19 15:17:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-19 15:17:59 (GMT) |
commit | ad77b80b0542a71eff54d1a193bd044a71e8e00b (patch) | |
tree | 088716f4cb0871b694facae033b14dcbdc5a6b44 /Python | |
parent | 3adb23a17d25e36bd80874e860835182d851623f (diff) | |
download | cpython-ad77b80b0542a71eff54d1a193bd044a71e8e00b.zip cpython-ad77b80b0542a71eff54d1a193bd044a71e8e00b.tar.gz cpython-ad77b80b0542a71eff54d1a193bd044a71e8e00b.tar.bz2 |
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (#102816)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bytecodes.c | 8 | ||||
-rw-r--r-- | Python/generated_cases.c.h | 638 | ||||
-rw-r--r-- | Python/import.c | 28 | ||||
-rw-r--r-- | Python/pythonrun.c | 2 |
4 files changed, 334 insertions, 342 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 74582ec..6c44870 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -778,9 +778,7 @@ dummy_func( } assert(exc && PyExceptionInstance_Check(exc)); Py_INCREF(exc); - PyObject *typ = Py_NewRef(PyExceptionInstance_Class(exc)); - PyObject *tb = PyException_GetTraceback(exc); - _PyErr_Restore(tstate, typ, exc, tb); + _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } @@ -791,9 +789,7 @@ dummy_func( } else { Py_INCREF(exc); - PyObject *typ = Py_NewRef(PyExceptionInstance_Class(exc)); - PyObject *tb = PyException_GetTraceback(exc); - _PyErr_Restore(tstate, typ, exc, tb); + _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } } diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 26f6be0..c5a7d90 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -1136,32 +1136,28 @@ } assert(exc && PyExceptionInstance_Check(exc)); Py_INCREF(exc); - PyObject *typ = Py_NewRef(PyExceptionInstance_Class(exc)); - PyObject *tb = PyException_GetTraceback(exc); - _PyErr_Restore(tstate, typ, exc, tb); + _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1144 "Python/generated_cases.c.h" + #line 1142 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 788 "Python/bytecodes.c" + #line 786 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1153 "Python/generated_cases.c.h" + #line 1151 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 791 "Python/bytecodes.c" + #line 789 "Python/bytecodes.c" } else { Py_INCREF(exc); - PyObject *typ = Py_NewRef(PyExceptionInstance_Class(exc)); - PyObject *tb = PyException_GetTraceback(exc); - _PyErr_Restore(tstate, typ, exc, tb); + _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1165 "Python/generated_cases.c.h" + #line 1161 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1172,23 +1168,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 802 "Python/bytecodes.c" + #line 798 "Python/bytecodes.c" assert(throwflag); assert(exc_value && PyExceptionInstance_Check(exc_value)); if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) { value = Py_NewRef(((PyStopIterationObject *)exc_value)->value); - #line 1181 "Python/generated_cases.c.h" + #line 1177 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 807 "Python/bytecodes.c" + #line 803 "Python/bytecodes.c" none = Py_NewRef(Py_None); } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1192 "Python/generated_cases.c.h" + #line 1188 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1197,9 +1193,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 816 "Python/bytecodes.c" + #line 812 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1203 "Python/generated_cases.c.h" + #line 1199 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1207,7 +1203,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 820 "Python/bytecodes.c" + #line 816 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1229,7 +1225,7 @@ if (true) goto error; } } - #line 1233 "Python/generated_cases.c.h" + #line 1229 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1237,33 +1233,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 844 "Python/bytecodes.c" + #line 840 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); - #line 1248 "Python/generated_cases.c.h" + #line 1244 "Python/generated_cases.c.h" Py_DECREF(v); - #line 851 "Python/bytecodes.c" + #line 847 "Python/bytecodes.c" if (true) goto pop_1_error; } if (PyDict_CheckExact(ns)) err = PyDict_SetItem(ns, name, v); else err = PyObject_SetItem(ns, name, v); - #line 1257 "Python/generated_cases.c.h" + #line 1253 "Python/generated_cases.c.h" Py_DECREF(v); - #line 858 "Python/bytecodes.c" + #line 854 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1261 "Python/generated_cases.c.h" + #line 1257 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 862 "Python/bytecodes.c" + #line 858 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1280,7 +1276,7 @@ name); goto error; } - #line 1284 "Python/generated_cases.c.h" + #line 1280 "Python/generated_cases.c.h" DISPATCH(); } @@ -1288,7 +1284,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 888 "Python/bytecodes.c" + #line 884 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1302,11 +1298,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1306 "Python/generated_cases.c.h" + #line 1302 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 902 "Python/bytecodes.c" + #line 898 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1310 "Python/generated_cases.c.h" + #line 1306 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1316,14 +1312,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 906 "Python/bytecodes.c" + #line 902 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE); assert(oparg == 2); STAT_INC(UNPACK_SEQUENCE, hit); values[0] = Py_NewRef(PyTuple_GET_ITEM(seq, 1)); values[1] = Py_NewRef(PyTuple_GET_ITEM(seq, 0)); - #line 1327 "Python/generated_cases.c.h" + #line 1323 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1334,7 +1330,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 916 "Python/bytecodes.c" + #line 912 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1342,7 +1338,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1346 "Python/generated_cases.c.h" + #line 1342 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1353,7 +1349,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 927 "Python/bytecodes.c" + #line 923 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1361,7 +1357,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1365 "Python/generated_cases.c.h" + #line 1361 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1371,15 +1367,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 938 "Python/bytecodes.c" + #line 934 "Python/bytecodes.c" int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8); PyObject **top = stack_pointer + totalargs - 1; int res = unpack_iterable(tstate, seq, oparg & 0xFF, oparg >> 8, top); - #line 1379 "Python/generated_cases.c.h" + #line 1375 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 942 "Python/bytecodes.c" + #line 938 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1383 "Python/generated_cases.c.h" + #line 1379 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1390,7 +1386,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 953 "Python/bytecodes.c" + #line 949 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { assert(cframe.use_tracing == 0); @@ -1407,12 +1403,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1411 "Python/generated_cases.c.h" + #line 1407 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 970 "Python/bytecodes.c" + #line 966 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1416 "Python/generated_cases.c.h" + #line 1412 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1420,34 +1416,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 974 "Python/bytecodes.c" + #line 970 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); - #line 1427 "Python/generated_cases.c.h" + #line 1423 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 977 "Python/bytecodes.c" + #line 973 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1431 "Python/generated_cases.c.h" + #line 1427 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 981 "Python/bytecodes.c" + #line 977 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1441 "Python/generated_cases.c.h" + #line 1437 "Python/generated_cases.c.h" Py_DECREF(v); - #line 984 "Python/bytecodes.c" + #line 980 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1445 "Python/generated_cases.c.h" + #line 1441 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 988 "Python/bytecodes.c" + #line 984 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1459,13 +1455,13 @@ } goto error; } - #line 1463 "Python/generated_cases.c.h" + #line 1459 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_NAME) { PyObject *v; - #line 1002 "Python/bytecodes.c" + #line 998 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *locals = LOCALS(); if (locals == NULL) { @@ -1524,7 +1520,7 @@ } } } - #line 1528 "Python/generated_cases.c.h" + #line 1524 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = v; DISPATCH(); @@ -1535,7 +1531,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1069 "Python/bytecodes.c" + #line 1065 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1588,7 +1584,7 @@ } } null = NULL; - #line 1592 "Python/generated_cases.c.h" + #line 1588 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -1602,7 +1598,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1124 "Python/bytecodes.c" + #line 1120 "Python/bytecodes.c" assert(cframe.use_tracing == 0); DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); @@ -1614,7 +1610,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1618 "Python/generated_cases.c.h" + #line 1614 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1629,7 +1625,7 @@ uint16_t index = read_u16(&next_instr[1].cache); uint16_t mod_version = read_u16(&next_instr[2].cache); uint16_t bltn_version = read_u16(&next_instr[3].cache); - #line 1138 "Python/bytecodes.c" + #line 1134 "Python/bytecodes.c" assert(cframe.use_tracing == 0); DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); @@ -1644,7 +1640,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1648 "Python/generated_cases.c.h" + #line 1644 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1654,16 +1650,16 @@ } TARGET(DELETE_FAST) { - #line 1155 "Python/bytecodes.c" + #line 1151 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 1662 "Python/generated_cases.c.h" + #line 1658 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1161 "Python/bytecodes.c" + #line 1157 "Python/bytecodes.c" // "initial" is probably NULL but not if it's an arg (or set // via PyFrame_LocalsToFast() before MAKE_CELL has run). PyObject *initial = GETLOCAL(oparg); @@ -1672,12 +1668,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 1676 "Python/generated_cases.c.h" + #line 1672 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1172 "Python/bytecodes.c" + #line 1168 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -1688,13 +1684,13 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 1692 "Python/generated_cases.c.h" + #line 1688 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_CLASSDEREF) { PyObject *value; - #line 1185 "Python/bytecodes.c" + #line 1181 "Python/bytecodes.c" PyObject *name, *locals = LOCALS(); assert(locals); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -1726,7 +1722,7 @@ } Py_INCREF(value); } - #line 1730 "Python/generated_cases.c.h" + #line 1726 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1734,7 +1730,7 @@ TARGET(LOAD_DEREF) { PyObject *value; - #line 1219 "Python/bytecodes.c" + #line 1215 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -1742,7 +1738,7 @@ if (true) goto error; } Py_INCREF(value); - #line 1746 "Python/generated_cases.c.h" + #line 1742 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1750,18 +1746,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1229 "Python/bytecodes.c" + #line 1225 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 1759 "Python/generated_cases.c.h" + #line 1755 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1236 "Python/bytecodes.c" + #line 1232 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -1772,22 +1768,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 1776 "Python/generated_cases.c.h" + #line 1772 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1249 "Python/bytecodes.c" + #line 1245 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 1785 "Python/generated_cases.c.h" + #line 1781 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1251 "Python/bytecodes.c" + #line 1247 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 1791 "Python/generated_cases.c.h" + #line 1787 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -1797,10 +1793,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1255 "Python/bytecodes.c" + #line 1251 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 1804 "Python/generated_cases.c.h" + #line 1800 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -1810,10 +1806,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1260 "Python/bytecodes.c" + #line 1256 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 1817 "Python/generated_cases.c.h" + #line 1813 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -1823,7 +1819,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1265 "Python/bytecodes.c" + #line 1261 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -1834,13 +1830,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 1838 "Python/generated_cases.c.h" + #line 1834 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1276 "Python/bytecodes.c" + #line 1272 "Python/bytecodes.c" if (true) goto pop_1_error; } Py_DECREF(none_val); - #line 1844 "Python/generated_cases.c.h" + #line 1840 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -1849,13 +1845,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1283 "Python/bytecodes.c" + #line 1279 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); - #line 1855 "Python/generated_cases.c.h" + #line 1851 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1285 "Python/bytecodes.c" + #line 1281 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 1859 "Python/generated_cases.c.h" + #line 1855 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1863,7 +1859,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1289 "Python/bytecodes.c" + #line 1285 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -1878,7 +1874,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 1882 "Python/generated_cases.c.h" + #line 1878 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -1888,7 +1884,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1306 "Python/bytecodes.c" + #line 1302 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -1896,13 +1892,13 @@ if (map == NULL) goto error; - #line 1900 "Python/generated_cases.c.h" + #line 1896 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1314 "Python/bytecodes.c" + #line 1310 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 1906 "Python/generated_cases.c.h" + #line 1902 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -1910,7 +1906,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1318 "Python/bytecodes.c" + #line 1314 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -1950,7 +1946,7 @@ Py_DECREF(ann_dict); } } - #line 1954 "Python/generated_cases.c.h" + #line 1950 "Python/generated_cases.c.h" DISPATCH(); } @@ -1958,7 +1954,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1360 "Python/bytecodes.c" + #line 1356 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1968,14 +1964,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 1972 "Python/generated_cases.c.h" + #line 1968 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1370 "Python/bytecodes.c" + #line 1366 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 1979 "Python/generated_cases.c.h" + #line 1975 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -1983,7 +1979,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1374 "Python/bytecodes.c" + #line 1370 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (PyDict_Update(dict, update) < 0) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { @@ -1991,12 +1987,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 1995 "Python/generated_cases.c.h" + #line 1991 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1382 "Python/bytecodes.c" + #line 1378 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2000 "Python/generated_cases.c.h" + #line 1996 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2004,17 +2000,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1388 "Python/bytecodes.c" + #line 1384 "Python/bytecodes.c" 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); - #line 2013 "Python/generated_cases.c.h" + #line 2009 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1393 "Python/bytecodes.c" + #line 1389 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2018 "Python/generated_cases.c.h" + #line 2014 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); PREDICT(CALL_FUNCTION_EX); @@ -2024,13 +2020,13 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1400 "Python/bytecodes.c" + #line 1396 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack assert(PyDict_CheckExact(dict)); /* dict[key] = value */ // Do not DECREF INPUTS because the function steals the references if (_PyDict_SetItem_Take2((PyDictObject *)dict, key, value) != 0) goto pop_2_error; - #line 2034 "Python/generated_cases.c.h" + #line 2030 "Python/generated_cases.c.h" STACK_SHRINK(2); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -2042,7 +2038,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1423 "Python/bytecodes.c" + #line 1419 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2077,9 +2073,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2081 "Python/generated_cases.c.h" + #line 2077 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1458 "Python/bytecodes.c" + #line 1454 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2088,12 +2084,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2092 "Python/generated_cases.c.h" + #line 2088 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1467 "Python/bytecodes.c" + #line 1463 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2097 "Python/generated_cases.c.h" + #line 2093 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2107,7 +2103,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1472 "Python/bytecodes.c" + #line 1468 "Python/bytecodes.c" assert(cframe.use_tracing == 0); PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); @@ -2121,7 +2117,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2125 "Python/generated_cases.c.h" + #line 2121 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2136,7 +2132,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1489 "Python/bytecodes.c" + #line 1485 "Python/bytecodes.c" assert(cframe.use_tracing == 0); DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; @@ -2150,7 +2146,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2154 "Python/generated_cases.c.h" + #line 2150 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2165,7 +2161,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1506 "Python/bytecodes.c" + #line 1502 "Python/bytecodes.c" assert(cframe.use_tracing == 0); PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); @@ -2193,7 +2189,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2197 "Python/generated_cases.c.h" + #line 2193 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2208,7 +2204,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1537 "Python/bytecodes.c" + #line 1533 "Python/bytecodes.c" assert(cframe.use_tracing == 0); PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); @@ -2219,7 +2215,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2223 "Python/generated_cases.c.h" + #line 2219 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2234,7 +2230,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1551 "Python/bytecodes.c" + #line 1547 "Python/bytecodes.c" assert(cframe.use_tracing == 0); DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); @@ -2247,7 +2243,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2251 "Python/generated_cases.c.h" + #line 2247 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2261,7 +2257,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *fget = read_obj(&next_instr[5].cache); - #line 1567 "Python/bytecodes.c" + #line 1563 "Python/bytecodes.c" assert(cframe.use_tracing == 0); DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); @@ -2285,7 +2281,7 @@ new_frame->localsplus[0] = owner; JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); DISPATCH_INLINED(new_frame); - #line 2289 "Python/generated_cases.c.h" + #line 2285 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2293,7 +2289,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *getattribute = read_obj(&next_instr[5].cache); - #line 1593 "Python/bytecodes.c" + #line 1589 "Python/bytecodes.c" assert(cframe.use_tracing == 0); DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2319,7 +2315,7 @@ new_frame->localsplus[1] = Py_NewRef(name); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); DISPATCH_INLINED(new_frame); - #line 2323 "Python/generated_cases.c.h" + #line 2319 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2327,7 +2323,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1621 "Python/bytecodes.c" + #line 1617 "Python/bytecodes.c" assert(cframe.use_tracing == 0); PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); @@ -2346,7 +2342,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2350 "Python/generated_cases.c.h" + #line 2346 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2357,7 +2353,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t hint = read_u16(&next_instr[3].cache); - #line 1642 "Python/bytecodes.c" + #line 1638 "Python/bytecodes.c" assert(cframe.use_tracing == 0); PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); @@ -2397,7 +2393,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2401 "Python/generated_cases.c.h" + #line 2397 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2408,7 +2404,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1684 "Python/bytecodes.c" + #line 1680 "Python/bytecodes.c" assert(cframe.use_tracing == 0); PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); @@ -2419,7 +2415,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2423 "Python/generated_cases.c.h" + #line 2419 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2429,16 +2425,16 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1697 "Python/bytecodes.c" + #line 1693 "Python/bytecodes.c" STAT_INC(COMPARE_OP, deferred); assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2437 "Python/generated_cases.c.h" + #line 2433 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1701 "Python/bytecodes.c" + #line 1697 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2442 "Python/generated_cases.c.h" + #line 2438 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2449,7 +2445,7 @@ PREDICTED(COMPARE_AND_BRANCH); PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; - #line 1713 "Python/bytecodes.c" + #line 1709 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2463,10 +2459,10 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); PyObject *cond = PyObject_RichCompare(left, right, oparg>>4); - #line 2467 "Python/generated_cases.c.h" + #line 2463 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1727 "Python/bytecodes.c" + #line 1723 "Python/bytecodes.c" if (cond == NULL) goto pop_2_error; assert(next_instr[1].op.code == POP_JUMP_IF_FALSE || next_instr[1].op.code == POP_JUMP_IF_TRUE); @@ -2478,7 +2474,7 @@ if (jump_on_true == (err != 0)) { JUMPBY(offset); } - #line 2482 "Python/generated_cases.c.h" + #line 2478 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 2; DISPATCH(); @@ -2487,7 +2483,7 @@ TARGET(COMPARE_AND_BRANCH_FLOAT) { PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; - #line 1741 "Python/bytecodes.c" + #line 1737 "Python/bytecodes.c" assert(cframe.use_tracing == 0); DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_AND_BRANCH); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_AND_BRANCH); @@ -2502,7 +2498,7 @@ int offset = next_instr[1].op.arg; JUMPBY(offset); } - #line 2506 "Python/generated_cases.c.h" + #line 2502 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 2; DISPATCH(); @@ -2511,7 +2507,7 @@ TARGET(COMPARE_AND_BRANCH_INT) { PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; - #line 1759 "Python/bytecodes.c" + #line 1755 "Python/bytecodes.c" assert(cframe.use_tracing == 0); DEOPT_IF(!PyLong_CheckExact(left), COMPARE_AND_BRANCH); DEOPT_IF(!PyLong_CheckExact(right), COMPARE_AND_BRANCH); @@ -2529,7 +2525,7 @@ int offset = next_instr[1].op.arg; JUMPBY(offset); } - #line 2533 "Python/generated_cases.c.h" + #line 2529 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 2; DISPATCH(); @@ -2538,7 +2534,7 @@ TARGET(COMPARE_AND_BRANCH_STR) { PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; - #line 1780 "Python/bytecodes.c" + #line 1776 "Python/bytecodes.c" assert(cframe.use_tracing == 0); DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_AND_BRANCH); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_AND_BRANCH); @@ -2554,7 +2550,7 @@ int offset = next_instr[1].op.arg; JUMPBY(offset); } - #line 2558 "Python/generated_cases.c.h" + #line 2554 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 2; DISPATCH(); @@ -2564,14 +2560,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1798 "Python/bytecodes.c" + #line 1794 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 2570 "Python/generated_cases.c.h" + #line 2566 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1800 "Python/bytecodes.c" + #line 1796 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2575 "Python/generated_cases.c.h" + #line 2571 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2581,15 +2577,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1804 "Python/bytecodes.c" + #line 1800 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 2587 "Python/generated_cases.c.h" + #line 2583 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1806 "Python/bytecodes.c" + #line 1802 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = Py_NewRef((res^oparg) ? Py_True : Py_False); - #line 2593 "Python/generated_cases.c.h" + #line 2589 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2600,12 +2596,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 1811 "Python/bytecodes.c" + #line 1807 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 2606 "Python/generated_cases.c.h" + #line 2602 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1813 "Python/bytecodes.c" + #line 1809 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2613,10 +2609,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 2617 "Python/generated_cases.c.h" + #line 2613 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1821 "Python/bytecodes.c" + #line 1817 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2625,7 +2621,7 @@ if (!Py_IsNone(match)) { PyErr_SetExcInfo(NULL, Py_NewRef(match), NULL); } - #line 2629 "Python/generated_cases.c.h" + #line 2625 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -2635,21 +2631,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1832 "Python/bytecodes.c" + #line 1828 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 2642 "Python/generated_cases.c.h" + #line 2638 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1835 "Python/bytecodes.c" + #line 1831 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 2649 "Python/generated_cases.c.h" + #line 2645 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1840 "Python/bytecodes.c" + #line 1836 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2653 "Python/generated_cases.c.h" + #line 2649 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -2658,15 +2654,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 1844 "Python/bytecodes.c" + #line 1840 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 2665 "Python/generated_cases.c.h" + #line 2661 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 1847 "Python/bytecodes.c" + #line 1843 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2670 "Python/generated_cases.c.h" + #line 2666 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2675,29 +2671,29 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 1851 "Python/bytecodes.c" + #line 1847 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 2683 "Python/generated_cases.c.h" + #line 2679 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 1857 "Python/bytecodes.c" + #line 1853 "Python/bytecodes.c" JUMPBY(oparg); - #line 2692 "Python/generated_cases.c.h" + #line 2688 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 1861 "Python/bytecodes.c" + #line 1857 "Python/bytecodes.c" assert(oparg < INSTR_OFFSET()); JUMPBY(-oparg); - #line 2701 "Python/generated_cases.c.h" + #line 2697 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } @@ -2705,7 +2701,7 @@ TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 1867 "Python/bytecodes.c" + #line 1863 "Python/bytecodes.c" if (Py_IsTrue(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2715,9 +2711,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2719 "Python/generated_cases.c.h" + #line 2715 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 1877 "Python/bytecodes.c" + #line 1873 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -2725,14 +2721,14 @@ if (err < 0) goto pop_1_error; } } - #line 2729 "Python/generated_cases.c.h" + #line 2725 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 1887 "Python/bytecodes.c" + #line 1883 "Python/bytecodes.c" if (Py_IsFalse(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2742,9 +2738,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2746 "Python/generated_cases.c.h" + #line 2742 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 1897 "Python/bytecodes.c" + #line 1893 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -2752,48 +2748,48 @@ if (err < 0) goto pop_1_error; } } - #line 2756 "Python/generated_cases.c.h" + #line 2752 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 1907 "Python/bytecodes.c" + #line 1903 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 2765 "Python/generated_cases.c.h" + #line 2761 "Python/generated_cases.c.h" Py_DECREF(value); - #line 1909 "Python/bytecodes.c" + #line 1905 "Python/bytecodes.c" JUMPBY(oparg); } else { _Py_DECREF_NO_DEALLOC(value); } - #line 2773 "Python/generated_cases.c.h" + #line 2769 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 1917 "Python/bytecodes.c" + #line 1913 "Python/bytecodes.c" if (Py_IsNone(value)) { _Py_DECREF_NO_DEALLOC(value); JUMPBY(oparg); } else { - #line 2786 "Python/generated_cases.c.h" + #line 2782 "Python/generated_cases.c.h" Py_DECREF(value); - #line 1923 "Python/bytecodes.c" + #line 1919 "Python/bytecodes.c" } - #line 2790 "Python/generated_cases.c.h" + #line 2786 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_IF_FALSE_OR_POP) { PyObject *cond = stack_pointer[-1]; - #line 1927 "Python/bytecodes.c" + #line 1923 "Python/bytecodes.c" bool jump = false; int err; if (Py_IsTrue(cond)) { @@ -2816,7 +2812,7 @@ goto error; } } - #line 2820 "Python/generated_cases.c.h" + #line 2816 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW((jump ? 1 : 0)); DISPATCH(); @@ -2824,7 +2820,7 @@ TARGET(JUMP_IF_TRUE_OR_POP) { PyObject *cond = stack_pointer[-1]; - #line 1952 "Python/bytecodes.c" + #line 1948 "Python/bytecodes.c" bool jump = false; int err; if (Py_IsFalse(cond)) { @@ -2847,34 +2843,34 @@ goto error; } } - #line 2851 "Python/generated_cases.c.h" + #line 2847 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW((jump ? 1 : 0)); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 1977 "Python/bytecodes.c" + #line 1973 "Python/bytecodes.c" /* This bytecode is used in the `yield from` or `await` loop. * If there is an interrupt, we want it handled in the innermost * generator or coroutine, so we deliberately do not check it here. * (see bpo-30039). */ JUMPBY(-oparg); - #line 2865 "Python/generated_cases.c.h" + #line 2861 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 1986 "Python/bytecodes.c" + #line 1982 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 2878 "Python/generated_cases.c.h" + #line 2874 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -2885,16 +2881,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 1994 "Python/bytecodes.c" + #line 1990 "Python/bytecodes.c" // 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); - #line 2894 "Python/generated_cases.c.h" + #line 2890 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 1999 "Python/bytecodes.c" + #line 1995 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -2902,7 +2898,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_NewRef(Py_None); // Failure! } - #line 2906 "Python/generated_cases.c.h" + #line 2902 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -2911,10 +2907,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2009 "Python/bytecodes.c" + #line 2005 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = Py_NewRef(match ? Py_True : Py_False); - #line 2918 "Python/generated_cases.c.h" + #line 2914 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2924,10 +2920,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2015 "Python/bytecodes.c" + #line 2011 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = Py_NewRef(match ? Py_True : Py_False); - #line 2931 "Python/generated_cases.c.h" + #line 2927 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2938,11 +2934,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2021 "Python/bytecodes.c" + #line 2017 "Python/bytecodes.c" // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = match_keys(tstate, subject, keys); if (values_or_none == NULL) goto error; - #line 2946 "Python/generated_cases.c.h" + #line 2942 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -2951,14 +2947,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2027 "Python/bytecodes.c" + #line 2023 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 2958 "Python/generated_cases.c.h" + #line 2954 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2030 "Python/bytecodes.c" + #line 2026 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 2962 "Python/generated_cases.c.h" + #line 2958 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -2966,7 +2962,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2034 "Python/bytecodes.c" + #line 2030 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -2989,11 +2985,11 @@ if (iter == NULL) { goto error; } - #line 2993 "Python/generated_cases.c.h" + #line 2989 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2057 "Python/bytecodes.c" + #line 2053 "Python/bytecodes.c" } - #line 2997 "Python/generated_cases.c.h" + #line 2993 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3004,7 +3000,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2076 "Python/bytecodes.c" + #line 2072 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3037,7 +3033,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3041 "Python/generated_cases.c.h" + #line 3037 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3047,7 +3043,7 @@ TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2111 "Python/bytecodes.c" + #line 2107 "Python/bytecodes.c" assert(cframe.use_tracing == 0); DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; @@ -3068,7 +3064,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3072 "Python/generated_cases.c.h" + #line 3068 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3078,7 +3074,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2134 "Python/bytecodes.c" + #line 2130 "Python/bytecodes.c" assert(cframe.use_tracing == 0); _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); @@ -3099,7 +3095,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3103 "Python/generated_cases.c.h" + #line 3099 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3109,7 +3105,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2157 "Python/bytecodes.c" + #line 2153 "Python/bytecodes.c" assert(cframe.use_tracing == 0); _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); @@ -3128,7 +3124,7 @@ if (next == NULL) { goto error; } - #line 3132 "Python/generated_cases.c.h" + #line 3128 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3137,7 +3133,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2178 "Python/bytecodes.c" + #line 2174 "Python/bytecodes.c" assert(cframe.use_tracing == 0); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3152,14 +3148,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg); assert(next_instr->op.code == END_FOR); DISPATCH_INLINED(gen_frame); - #line 3156 "Python/generated_cases.c.h" + #line 3152 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2195 "Python/bytecodes.c" + #line 2191 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3182,16 +3178,16 @@ Py_DECREF(enter); goto error; } - #line 3186 "Python/generated_cases.c.h" + #line 3182 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2218 "Python/bytecodes.c" + #line 2214 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3195 "Python/generated_cases.c.h" + #line 3191 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3203,7 +3199,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2228 "Python/bytecodes.c" + #line 2224 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3229,16 +3225,16 @@ Py_DECREF(enter); goto error; } - #line 3233 "Python/generated_cases.c.h" + #line 3229 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2254 "Python/bytecodes.c" + #line 2250 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3242 "Python/generated_cases.c.h" + #line 3238 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3250,7 +3246,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2263 "Python/bytecodes.c" + #line 2259 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3271,7 +3267,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3275 "Python/generated_cases.c.h" + #line 3271 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3280,7 +3276,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2286 "Python/bytecodes.c" + #line 2282 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3290,7 +3286,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3294 "Python/generated_cases.c.h" + #line 3290 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3304,7 +3300,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t keys_version = read_u32(&next_instr[3].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2298 "Python/bytecodes.c" + #line 2294 "Python/bytecodes.c" /* Cached method object */ assert(cframe.use_tracing == 0); PyTypeObject *self_cls = Py_TYPE(self); @@ -3322,7 +3318,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3326 "Python/generated_cases.c.h" + #line 3322 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3336,7 +3332,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2318 "Python/bytecodes.c" + #line 2314 "Python/bytecodes.c" assert(cframe.use_tracing == 0); PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); @@ -3347,7 +3343,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3351 "Python/generated_cases.c.h" + #line 3347 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3361,7 +3357,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2331 "Python/bytecodes.c" + #line 2327 "Python/bytecodes.c" assert(cframe.use_tracing == 0); PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); @@ -3376,7 +3372,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3380 "Python/generated_cases.c.h" + #line 3376 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3385,11 +3381,11 @@ } TARGET(KW_NAMES) { - #line 2348 "Python/bytecodes.c" + #line 2344 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); kwnames = GETITEM(frame->f_code->co_consts, oparg); - #line 3393 "Python/generated_cases.c.h" + #line 3389 "Python/generated_cases.c.h" DISPATCH(); } @@ -3400,7 +3396,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2384 "Python/bytecodes.c" + #line 2380 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3472,7 +3468,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3476 "Python/generated_cases.c.h" + #line 3472 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3484,7 +3480,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2462 "Python/bytecodes.c" + #line 2458 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3494,7 +3490,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3498 "Python/generated_cases.c.h" + #line 3494 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3503,7 +3499,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2474 "Python/bytecodes.c" + #line 2470 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3528,7 +3524,7 @@ STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); DISPATCH_INLINED(new_frame); - #line 3532 "Python/generated_cases.c.h" + #line 3528 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3537,7 +3533,7 @@ PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); uint16_t min_args = read_u16(&next_instr[3].cache); - #line 2501 "Python/bytecodes.c" + #line 2497 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3567,7 +3563,7 @@ STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); DISPATCH_INLINED(new_frame); - #line 3571 "Python/generated_cases.c.h" + #line 3567 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -3575,7 +3571,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2533 "Python/bytecodes.c" + #line 2529 "Python/bytecodes.c" assert(kwnames == NULL); assert(cframe.use_tracing == 0); assert(oparg == 1); @@ -3586,7 +3582,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 3590 "Python/generated_cases.c.h" + #line 3586 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3599,7 +3595,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2546 "Python/bytecodes.c" + #line 2542 "Python/bytecodes.c" assert(kwnames == NULL); assert(cframe.use_tracing == 0); assert(oparg == 1); @@ -3611,7 +3607,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3615 "Python/generated_cases.c.h" + #line 3611 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3625,7 +3621,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2561 "Python/bytecodes.c" + #line 2557 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3636,7 +3632,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3640 "Python/generated_cases.c.h" + #line 3636 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3650,7 +3646,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2575 "Python/bytecodes.c" + #line 2571 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3672,7 +3668,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3676 "Python/generated_cases.c.h" + #line 3672 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3686,7 +3682,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2600 "Python/bytecodes.c" + #line 2596 "Python/bytecodes.c" assert(cframe.use_tracing == 0); /* Builtin METH_O functions */ assert(kwnames == NULL); @@ -3715,7 +3711,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3719 "Python/generated_cases.c.h" + #line 3715 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3729,7 +3725,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2632 "Python/bytecodes.c" + #line 2628 "Python/bytecodes.c" assert(cframe.use_tracing == 0); /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); @@ -3762,7 +3758,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 3766 "Python/generated_cases.c.h" + #line 3762 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3776,7 +3772,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2668 "Python/bytecodes.c" + #line 2664 "Python/bytecodes.c" assert(cframe.use_tracing == 0); /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; @@ -3809,7 +3805,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3813 "Python/generated_cases.c.h" + #line 3809 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3823,7 +3819,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2704 "Python/bytecodes.c" + #line 2700 "Python/bytecodes.c" assert(cframe.use_tracing == 0); assert(kwnames == NULL); /* len(o) */ @@ -3849,7 +3845,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3853 "Python/generated_cases.c.h" + #line 3849 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3862,7 +3858,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2732 "Python/bytecodes.c" + #line 2728 "Python/bytecodes.c" assert(cframe.use_tracing == 0); assert(kwnames == NULL); /* isinstance(o, o2) */ @@ -3890,7 +3886,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3894 "Python/generated_cases.c.h" + #line 3890 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3902,7 +3898,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2763 "Python/bytecodes.c" + #line 2759 "Python/bytecodes.c" assert(cframe.use_tracing == 0); assert(kwnames == NULL); assert(oparg == 1); @@ -3921,14 +3917,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 3925 "Python/generated_cases.c.h" + #line 3921 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2784 "Python/bytecodes.c" + #line 2780 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -3959,7 +3955,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3963 "Python/generated_cases.c.h" + #line 3959 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3972,7 +3968,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2818 "Python/bytecodes.c" + #line 2814 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4001,7 +3997,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4005 "Python/generated_cases.c.h" + #line 4001 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4014,7 +4010,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2850 "Python/bytecodes.c" + #line 2846 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4043,7 +4039,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4047 "Python/generated_cases.c.h" + #line 4043 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4056,7 +4052,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2882 "Python/bytecodes.c" + #line 2878 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4084,7 +4080,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4088 "Python/generated_cases.c.h" + #line 4084 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4099,7 +4095,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 2913 "Python/bytecodes.c" + #line 2909 "Python/bytecodes.c" if (oparg & 1) { // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. @@ -4118,15 +4114,15 @@ assert(PyTuple_CheckExact(callargs)); result = do_call_core(tstate, func, callargs, kwargs, cframe.use_tracing); - #line 4122 "Python/generated_cases.c.h" + #line 4118 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 2932 "Python/bytecodes.c" + #line 2928 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4130 "Python/generated_cases.c.h" + #line 4126 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4141,7 +4137,7 @@ PyObject *kwdefaults = (oparg & 0x02) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & 0x01) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x01) ? 1 : 0))] : NULL; PyObject *func; - #line 2943 "Python/bytecodes.c" + #line 2939 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4170,14 +4166,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4174 "Python/generated_cases.c.h" + #line 4170 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 0x01) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x08) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 2974 "Python/bytecodes.c" + #line 2970 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4198,7 +4194,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4202 "Python/generated_cases.c.h" + #line 4198 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4206,15 +4202,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 2997 "Python/bytecodes.c" + #line 2993 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4212 "Python/generated_cases.c.h" + #line 4208 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 2999 "Python/bytecodes.c" + #line 2995 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4218 "Python/generated_cases.c.h" + #line 4214 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4225,7 +4221,7 @@ PyObject *fmt_spec = ((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? stack_pointer[-((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))] : NULL; PyObject *value = stack_pointer[-(1 + (((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))]; PyObject *result; - #line 3003 "Python/bytecodes.c" + #line 2999 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4267,13 +4263,13 @@ } else { /* Actually call format(). */ result = PyObject_Format(value, fmt_spec); - #line 4271 "Python/generated_cases.c.h" + #line 4267 "Python/generated_cases.c.h" Py_DECREF(value); Py_XDECREF(fmt_spec); - #line 3045 "Python/bytecodes.c" + #line 3041 "Python/bytecodes.c" if (result == NULL) { STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); goto pop_1_error; } } - #line 4277 "Python/generated_cases.c.h" + #line 4273 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4282,10 +4278,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3050 "Python/bytecodes.c" + #line 3046 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4289 "Python/generated_cases.c.h" + #line 4285 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4297,7 +4293,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3055 "Python/bytecodes.c" + #line 3051 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4313,12 +4309,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4317 "Python/generated_cases.c.h" + #line 4313 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3071 "Python/bytecodes.c" + #line 3067 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4322 "Python/generated_cases.c.h" + #line 4318 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4328,27 +4324,27 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3076 "Python/bytecodes.c" + #line 3072 "Python/bytecodes.c" assert(oparg >= 2); - #line 4334 "Python/generated_cases.c.h" + #line 4330 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3080 "Python/bytecodes.c" + #line 3076 "Python/bytecodes.c" assert(oparg); assert(cframe.use_tracing == 0); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4348 "Python/generated_cases.c.h" + #line 4344 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3089 "Python/bytecodes.c" + #line 3085 "Python/bytecodes.c" Py_UNREACHABLE(); - #line 4354 "Python/generated_cases.c.h" + #line 4350 "Python/generated_cases.c.h" } diff --git a/Python/import.c b/Python/import.c index 9f80c6d..c68bd1f 100644 --- a/Python/import.c +++ b/Python/import.c @@ -389,8 +389,7 @@ PyImport_AddModule(const char *name) static void remove_module(PyThreadState *tstate, PyObject *name) { - PyObject *type, *value, *traceback; - _PyErr_Fetch(tstate, &type, &value, &traceback); + PyObject *exc = _PyErr_GetRaisedException(tstate); PyObject *modules = MODULES(tstate->interp); if (PyDict_CheckExact(modules)) { @@ -403,7 +402,7 @@ remove_module(PyThreadState *tstate, PyObject *name) } } - _PyErr_ChainExceptions(type, value, traceback); + _PyErr_ChainExceptions1(exc); } @@ -2324,32 +2323,34 @@ remove_importlib_frames(PyThreadState *tstate) const char *remove_frames = "_call_with_frames_removed"; int always_trim = 0; int in_importlib = 0; - PyObject *exception, *value, *base_tb, *tb; PyObject **prev_link, **outer_link = NULL; + PyObject *base_tb = NULL; /* Synopsis: if it's an ImportError, we trim all importlib chunks from the traceback. We always trim chunks which end with a call to "_call_with_frames_removed". */ - _PyErr_Fetch(tstate, &exception, &value, &base_tb); - if (!exception || _PyInterpreterState_GetConfig(tstate->interp)->verbose) { + PyObject *exc = _PyErr_GetRaisedException(tstate); + if (exc == NULL || _PyInterpreterState_GetConfig(tstate->interp)->verbose) { goto done; } - if (PyType_IsSubtype((PyTypeObject *) exception, - (PyTypeObject *) PyExc_ImportError)) + if (PyType_IsSubtype(Py_TYPE(exc), (PyTypeObject *) PyExc_ImportError)) { always_trim = 1; + } + assert(PyExceptionInstance_Check(exc)); + base_tb = PyException_GetTraceback(exc); prev_link = &base_tb; - tb = base_tb; + PyObject *tb = base_tb; while (tb != NULL) { + assert(PyTraceBack_Check(tb)); PyTracebackObject *traceback = (PyTracebackObject *)tb; PyObject *next = (PyObject *) traceback->tb_next; PyFrameObject *frame = traceback->tb_frame; PyCodeObject *code = PyFrame_GetCode(frame); int now_in_importlib; - assert(PyTraceBack_Check(tb)); now_in_importlib = _PyUnicode_EqualToASCIIString(code->co_filename, importlib_filename) || _PyUnicode_EqualToASCIIString(code->co_filename, external_filename); if (now_in_importlib && !in_importlib) { @@ -2370,15 +2371,14 @@ remove_importlib_frames(PyThreadState *tstate) Py_DECREF(code); tb = next; } - assert(PyExceptionInstance_Check(value)); - assert((PyObject *)Py_TYPE(value) == exception); if (base_tb == NULL) { base_tb = Py_None; Py_INCREF(Py_None); } - PyException_SetTraceback(value, base_tb); + PyException_SetTraceback(exc, base_tb); done: - _PyErr_Restore(tstate, exception, value, base_tb); + Py_XDECREF(base_tb); + _PyErr_SetRaisedException(tstate, exc); } diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 6ea185a..b16d3f5 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -18,7 +18,7 @@ #include "pycore_interp.h" // PyInterpreterState.importlib #include "pycore_object.h" // _PyDebug_PrintTotalRefs() #include "pycore_parser.h" // _PyParser_ASTFromString() -#include "pycore_pyerrors.h" // _PyErr_Fetch, _Py_Offer_Suggestions +#include "pycore_pyerrors.h" // _PyErr_GetRaisedException, _Py_Offer_Suggestions #include "pycore_pylifecycle.h" // _Py_UnhandledKeyboardInterrupt #include "pycore_pystate.h" // _PyInterpreterState_GET() #include "pycore_sysmodule.h" // _PySys_Audit() |