From dc9fee6a5d4641dc29ffc910eb799504f99a8b8f Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Wed, 12 Apr 2023 19:23:58 +0100 Subject: [PATCH 1/4] Use return-offset, not yield-offset, so that instruction pointer is correct when sending to a generator or coroutine. --- Include/internal/pycore_frame.h | 4 +- Lib/test/test_generators.py | 15 + Python/bytecodes.c | 29 +- Python/ceval.c | 3 +- Python/ceval_macros.h | 2 +- Python/generated_cases.c.h | 747 ++++++++++++++++---------------- 6 files changed, 417 insertions(+), 383 deletions(-) diff --git a/Include/internal/pycore_frame.h b/Include/internal/pycore_frame.h index 856297aaea8ab4..8d5cec038edbcb 100644 --- a/Include/internal/pycore_frame.h +++ b/Include/internal/pycore_frame.h @@ -61,7 +61,7 @@ typedef struct _PyInterpreterFrame { // over, or (in the case of a newly-created frame) a totally invalid value: _Py_CODEUNIT *prev_instr; int stacktop; /* Offset of TOS from localsplus */ - uint16_t yield_offset; + uint16_t return_offset; char owner; /* Locals and stack */ PyObject *localsplus[1]; @@ -121,7 +121,7 @@ _PyFrame_Initialize( frame->stacktop = code->co_nlocalsplus; frame->frame_obj = NULL; frame->prev_instr = _PyCode_CODE(code) - 1; - frame->yield_offset = 0; + frame->return_offset = 0; frame->owner = FRAME_OWNED_BY_THREAD; for (int i = null_locals_from; i < code->co_nlocalsplus; i++) { diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index a5949dec70d176..cc782ea1ee5dff 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -225,7 +225,22 @@ def f(): gi = f() self.assertIsNone(gi.gi_frame.f_back) + def test_issue103488(self): + def gen_raises(): + yield + raise ValueError() + + def loop(): + try: + for _ in gen_raises(): + if True is False: + return + except ValueError: + pass + + #This should not raise + loop() class ExceptionTest(unittest.TestCase): # Tests for the issue #23353: check that the currently handled exception diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 5c6398aba198f9..31987df0ef5bb5 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -637,6 +637,8 @@ dummy_func( _PyInterpreterFrame *dying = frame; frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); + frame->prev_instr += frame->return_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -655,6 +657,8 @@ dummy_func( _PyInterpreterFrame *dying = frame; frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); + frame->prev_instr += frame->return_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -670,6 +674,8 @@ dummy_func( _PyInterpreterFrame *dying = frame; frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); + frame->prev_instr += frame->return_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -689,6 +695,8 @@ dummy_func( _PyInterpreterFrame *dying = frame; frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); + frame->prev_instr += frame->return_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -823,13 +831,13 @@ dummy_func( { PyGenObject *gen = (PyGenObject *)receiver; _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; - frame->yield_offset = oparg; + frame->return_offset = oparg; STACK_SHRINK(1); _PyFrame_StackPush(gen_frame, v); gen->gi_frame_state = FRAME_EXECUTING; gen->gi_exc_state.previous_item = tstate->exc_info; tstate->exc_info = &gen->gi_exc_state; - JUMPBY(INLINE_CACHE_ENTRIES_SEND + oparg); + JUMPBY(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); } if (Py_IsNone(v) && PyIter_Check(receiver)) { @@ -861,13 +869,13 @@ dummy_func( DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, SEND); STAT_INC(SEND, hit); _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; - frame->yield_offset = oparg; + frame->return_offset = oparg; STACK_SHRINK(1); _PyFrame_StackPush(gen_frame, v); gen->gi_frame_state = FRAME_EXECUTING; gen->gi_exc_state.previous_item = tstate->exc_info; tstate->exc_info = &gen->gi_exc_state; - JUMPBY(INLINE_CACHE_ENTRIES_SEND + oparg); + JUMPBY(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); } @@ -886,7 +894,7 @@ dummy_func( _PyInterpreterFrame *gen_frame = frame; frame = cframe.current_frame = frame->previous; gen_frame->previous = NULL; - frame->prev_instr -= frame->yield_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -905,7 +913,7 @@ dummy_func( _PyInterpreterFrame *gen_frame = frame; frame = cframe.current_frame = frame->previous; gen_frame->previous = NULL; - frame->prev_instr -= frame->yield_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -2259,14 +2267,14 @@ dummy_func( DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, FOR_ITER); STAT_INC(FOR_ITER, hit); _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; - frame->yield_offset = oparg; + frame->return_offset = oparg; _PyFrame_StackPush(gen_frame, Py_NewRef(Py_None)); gen->gi_frame_state = FRAME_EXECUTING; gen->gi_exc_state.previous_item = tstate->exc_info; tstate->exc_info = &gen->gi_exc_state; - JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg); - assert(next_instr->op.code == END_FOR || - next_instr->op.code == INSTRUMENTED_END_FOR); + JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER); + assert(next_instr[oparg].op.code == END_FOR || + next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); } @@ -3114,6 +3122,7 @@ dummy_func( _PyThreadState_PopFrame(tstate, frame); frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); + assert(frame->return_offset == 0); goto resume_frame; } diff --git a/Python/ceval.c b/Python/ceval.c index a38c9ec9ad5f9c..8c43e3d89c2c2a 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -672,7 +672,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int _PyCode_CODE(tstate->interp->interpreter_trampoline); entry_frame.stacktop = 0; entry_frame.owner = FRAME_OWNED_BY_CSTACK; - entry_frame.yield_offset = 0; + entry_frame.return_offset = 0; /* Push frame */ entry_frame.previous = prev_cframe->current_frame; frame->previous = &entry_frame; @@ -881,6 +881,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int _PyInterpreterFrame *dying = frame; frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); + frame->return_offset = 0; if (frame == &entry_frame) { /* Restore previous cframe and exit */ tstate->cframe = cframe.previous; diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index 485771ac65a767..308112c1884169 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -72,7 +72,7 @@ #endif #if USE_COMPUTED_GOTOS -# define TARGET(op) TARGET_##op: INSTRUCTION_START(op); +# define TARGET(op) TARGET_##op: INSTRUCTION_START(op); assert(frame->return_offset == 0); # define DISPATCH_GOTO() goto *opcode_targets[opcode] #else # define TARGET(op) case op: TARGET_##op: INSTRUCTION_START(op); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 4d52e95dc04a27..e8a1eeac102e41 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -922,14 +922,16 @@ _PyInterpreterFrame *dying = frame; frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); + frame->prev_instr += frame->return_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 928 "Python/generated_cases.c.h" + #line 930 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 645 "Python/bytecodes.c" + #line 647 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -943,13 +945,15 @@ _PyInterpreterFrame *dying = frame; frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); + frame->prev_instr += frame->return_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 949 "Python/generated_cases.c.h" + #line 953 "Python/generated_cases.c.h" } TARGET(RETURN_CONST) { - #line 663 "Python/bytecodes.c" + #line 667 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -960,13 +964,15 @@ _PyInterpreterFrame *dying = frame; frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); + frame->prev_instr += frame->return_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 966 "Python/generated_cases.c.h" + #line 972 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_CONST) { - #line 678 "Python/bytecodes.c" + #line 684 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -981,15 +987,17 @@ _PyInterpreterFrame *dying = frame; frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); + frame->prev_instr += frame->return_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 987 "Python/generated_cases.c.h" + #line 995 "Python/generated_cases.c.h" } TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; - #line 697 "Python/bytecodes.c" + #line 705 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -1002,16 +1010,16 @@ "'async for' requires an object with " "__aiter__ method, got %.100s", type->tp_name); - #line 1006 "Python/generated_cases.c.h" + #line 1014 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 710 "Python/bytecodes.c" + #line 718 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); - #line 1013 "Python/generated_cases.c.h" + #line 1021 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 715 "Python/bytecodes.c" + #line 723 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -1024,7 +1032,7 @@ Py_DECREF(iter); if (true) goto pop_1_error; } - #line 1028 "Python/generated_cases.c.h" + #line 1036 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1032,7 +1040,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; - #line 730 "Python/bytecodes.c" + #line 738 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -1076,7 +1084,7 @@ } } - #line 1080 "Python/generated_cases.c.h" + #line 1088 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = awaitable; PREDICT(LOAD_CONST); @@ -1087,16 +1095,16 @@ PREDICTED(GET_AWAITABLE); PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 777 "Python/bytecodes.c" + #line 785 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { format_awaitable_error(tstate, Py_TYPE(iterable), oparg); } - #line 1098 "Python/generated_cases.c.h" + #line 1106 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 784 "Python/bytecodes.c" + #line 792 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -1114,7 +1122,7 @@ if (iter == NULL) goto pop_1_error; - #line 1118 "Python/generated_cases.c.h" + #line 1126 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -1125,7 +1133,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; - #line 810 "Python/bytecodes.c" + #line 818 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1142,13 +1150,13 @@ { PyGenObject *gen = (PyGenObject *)receiver; _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; - frame->yield_offset = oparg; + frame->return_offset = oparg; STACK_SHRINK(1); _PyFrame_StackPush(gen_frame, v); gen->gi_frame_state = FRAME_EXECUTING; gen->gi_exc_state.previous_item = tstate->exc_info; tstate->exc_info = &gen->gi_exc_state; - JUMPBY(INLINE_CACHE_ENTRIES_SEND + oparg); + JUMPBY(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); } if (Py_IsNone(v) && PyIter_Check(receiver)) { @@ -1171,7 +1179,7 @@ } } Py_DECREF(v); - #line 1175 "Python/generated_cases.c.h" + #line 1183 "Python/generated_cases.c.h" stack_pointer[-1] = retval; next_instr += 1; DISPATCH(); @@ -1180,27 +1188,27 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 858 "Python/bytecodes.c" + #line 866 "Python/bytecodes.c" PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && Py_TYPE(gen) != &PyCoro_Type, SEND); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, SEND); STAT_INC(SEND, hit); _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; - frame->yield_offset = oparg; + frame->return_offset = oparg; STACK_SHRINK(1); _PyFrame_StackPush(gen_frame, v); gen->gi_frame_state = FRAME_EXECUTING; gen->gi_exc_state.previous_item = tstate->exc_info; tstate->exc_info = &gen->gi_exc_state; - JUMPBY(INLINE_CACHE_ENTRIES_SEND + oparg); + JUMPBY(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); - #line 1199 "Python/generated_cases.c.h" + #line 1207 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 875 "Python/bytecodes.c" + #line 883 "Python/bytecodes.c" assert(frame != &entry_frame); PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; @@ -1215,15 +1223,15 @@ _PyInterpreterFrame *gen_frame = frame; frame = cframe.current_frame = frame->previous; gen_frame->previous = NULL; - frame->prev_instr -= frame->yield_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1222 "Python/generated_cases.c.h" + #line 1230 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 895 "Python/bytecodes.c" + #line 903 "Python/bytecodes.c" // NOTE: It's important that YIELD_VALUE never raises an exception! // The compiler treats any exception raised here as a failed close() // or throw() call. @@ -1237,18 +1245,18 @@ _PyInterpreterFrame *gen_frame = frame; frame = cframe.current_frame = frame->previous; gen_frame->previous = NULL; - frame->prev_instr -= frame->yield_offset; + frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1244 "Python/generated_cases.c.h" + #line 1252 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 914 "Python/bytecodes.c" + #line 922 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); - #line 1252 "Python/generated_cases.c.h" + #line 1260 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1256,7 +1264,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 919 "Python/bytecodes.c" + #line 927 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1274,26 +1282,26 @@ Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1278 "Python/generated_cases.c.h" + #line 1286 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 939 "Python/bytecodes.c" + #line 947 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1287 "Python/generated_cases.c.h" + #line 1295 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 942 "Python/bytecodes.c" + #line 950 "Python/bytecodes.c" } else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1297 "Python/generated_cases.c.h" + #line 1305 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1304,23 +1312,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 951 "Python/bytecodes.c" + #line 959 "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 1313 "Python/generated_cases.c.h" + #line 1321 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 956 "Python/bytecodes.c" + #line 964 "Python/bytecodes.c" none = Py_NewRef(Py_None); } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1324 "Python/generated_cases.c.h" + #line 1332 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1329,9 +1337,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 965 "Python/bytecodes.c" + #line 973 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1335 "Python/generated_cases.c.h" + #line 1343 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1339,7 +1347,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 969 "Python/bytecodes.c" + #line 977 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1361,7 +1369,7 @@ if (true) goto error; } } - #line 1365 "Python/generated_cases.c.h" + #line 1373 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1369,33 +1377,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 993 "Python/bytecodes.c" + #line 1001 "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 1380 "Python/generated_cases.c.h" + #line 1388 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1000 "Python/bytecodes.c" + #line 1008 "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 1389 "Python/generated_cases.c.h" + #line 1397 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1007 "Python/bytecodes.c" + #line 1015 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1393 "Python/generated_cases.c.h" + #line 1401 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 1011 "Python/bytecodes.c" + #line 1019 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1412,7 +1420,7 @@ name); goto error; } - #line 1416 "Python/generated_cases.c.h" + #line 1424 "Python/generated_cases.c.h" DISPATCH(); } @@ -1420,7 +1428,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1037 "Python/bytecodes.c" + #line 1045 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1433,11 +1441,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1437 "Python/generated_cases.c.h" + #line 1445 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1050 "Python/bytecodes.c" + #line 1058 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1441 "Python/generated_cases.c.h" + #line 1449 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1447,14 +1455,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1054 "Python/bytecodes.c" + #line 1062 "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 1458 "Python/generated_cases.c.h" + #line 1466 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1465,7 +1473,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1064 "Python/bytecodes.c" + #line 1072 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1473,7 +1481,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1477 "Python/generated_cases.c.h" + #line 1485 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1484,7 +1492,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1075 "Python/bytecodes.c" + #line 1083 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1492,7 +1500,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1496 "Python/generated_cases.c.h" + #line 1504 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1502,15 +1510,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1086 "Python/bytecodes.c" + #line 1094 "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 1510 "Python/generated_cases.c.h" + #line 1518 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1090 "Python/bytecodes.c" + #line 1098 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1514 "Python/generated_cases.c.h" + #line 1522 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1521,7 +1529,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1101 "Python/bytecodes.c" + #line 1109 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg); @@ -1537,12 +1545,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1541 "Python/generated_cases.c.h" + #line 1549 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1117 "Python/bytecodes.c" + #line 1125 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1546 "Python/generated_cases.c.h" + #line 1554 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1550,34 +1558,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1121 "Python/bytecodes.c" + #line 1129 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); - #line 1557 "Python/generated_cases.c.h" + #line 1565 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1124 "Python/bytecodes.c" + #line 1132 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1561 "Python/generated_cases.c.h" + #line 1569 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1128 "Python/bytecodes.c" + #line 1136 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1571 "Python/generated_cases.c.h" + #line 1579 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1131 "Python/bytecodes.c" + #line 1139 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1575 "Python/generated_cases.c.h" + #line 1583 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 1135 "Python/bytecodes.c" + #line 1143 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1589,13 +1597,13 @@ } goto error; } - #line 1593 "Python/generated_cases.c.h" + #line 1601 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_NAME) { PyObject *v; - #line 1149 "Python/bytecodes.c" + #line 1157 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *locals = LOCALS(); if (locals == NULL) { @@ -1654,7 +1662,7 @@ } } } - #line 1658 "Python/generated_cases.c.h" + #line 1666 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = v; DISPATCH(); @@ -1665,7 +1673,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1216 "Python/bytecodes.c" + #line 1224 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1717,7 +1725,7 @@ } } null = NULL; - #line 1721 "Python/generated_cases.c.h" + #line 1729 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -1731,7 +1739,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1270 "Python/bytecodes.c" + #line 1278 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -1742,7 +1750,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1746 "Python/generated_cases.c.h" + #line 1754 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1757,7 +1765,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 1283 "Python/bytecodes.c" + #line 1291 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -1772,7 +1780,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1776 "Python/generated_cases.c.h" + #line 1784 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1782,16 +1790,16 @@ } TARGET(DELETE_FAST) { - #line 1300 "Python/bytecodes.c" + #line 1308 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 1790 "Python/generated_cases.c.h" + #line 1798 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1306 "Python/bytecodes.c" + #line 1314 "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); @@ -1800,12 +1808,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 1804 "Python/generated_cases.c.h" + #line 1812 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1317 "Python/bytecodes.c" + #line 1325 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -1816,13 +1824,13 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 1820 "Python/generated_cases.c.h" + #line 1828 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_CLASSDEREF) { PyObject *value; - #line 1330 "Python/bytecodes.c" + #line 1338 "Python/bytecodes.c" PyObject *name, *locals = LOCALS(); assert(locals); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -1854,7 +1862,7 @@ } Py_INCREF(value); } - #line 1858 "Python/generated_cases.c.h" + #line 1866 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1862,7 +1870,7 @@ TARGET(LOAD_DEREF) { PyObject *value; - #line 1364 "Python/bytecodes.c" + #line 1372 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -1870,7 +1878,7 @@ if (true) goto error; } Py_INCREF(value); - #line 1874 "Python/generated_cases.c.h" + #line 1882 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1878,18 +1886,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1374 "Python/bytecodes.c" + #line 1382 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 1887 "Python/generated_cases.c.h" + #line 1895 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1381 "Python/bytecodes.c" + #line 1389 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -1900,22 +1908,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 1904 "Python/generated_cases.c.h" + #line 1912 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1394 "Python/bytecodes.c" + #line 1402 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 1913 "Python/generated_cases.c.h" + #line 1921 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1396 "Python/bytecodes.c" + #line 1404 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 1919 "Python/generated_cases.c.h" + #line 1927 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -1925,10 +1933,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1400 "Python/bytecodes.c" + #line 1408 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 1932 "Python/generated_cases.c.h" + #line 1940 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -1938,10 +1946,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1405 "Python/bytecodes.c" + #line 1413 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 1945 "Python/generated_cases.c.h" + #line 1953 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -1951,7 +1959,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1410 "Python/bytecodes.c" + #line 1418 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -1962,13 +1970,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 1966 "Python/generated_cases.c.h" + #line 1974 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1421 "Python/bytecodes.c" + #line 1429 "Python/bytecodes.c" if (true) goto pop_1_error; } Py_DECREF(none_val); - #line 1972 "Python/generated_cases.c.h" + #line 1980 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -1977,13 +1985,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1428 "Python/bytecodes.c" + #line 1436 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); - #line 1983 "Python/generated_cases.c.h" + #line 1991 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1430 "Python/bytecodes.c" + #line 1438 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 1987 "Python/generated_cases.c.h" + #line 1995 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1991,7 +1999,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1434 "Python/bytecodes.c" + #line 1442 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2006,7 +2014,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 2010 "Python/generated_cases.c.h" + #line 2018 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -2016,7 +2024,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1451 "Python/bytecodes.c" + #line 1459 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2024,13 +2032,13 @@ if (map == NULL) goto error; - #line 2028 "Python/generated_cases.c.h" + #line 2036 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1459 "Python/bytecodes.c" + #line 1467 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 2034 "Python/generated_cases.c.h" + #line 2042 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -2038,7 +2046,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1463 "Python/bytecodes.c" + #line 1471 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2078,7 +2086,7 @@ Py_DECREF(ann_dict); } } - #line 2082 "Python/generated_cases.c.h" + #line 2090 "Python/generated_cases.c.h" DISPATCH(); } @@ -2086,7 +2094,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1505 "Python/bytecodes.c" + #line 1513 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2096,14 +2104,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 2100 "Python/generated_cases.c.h" + #line 2108 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1515 "Python/bytecodes.c" + #line 1523 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 2107 "Python/generated_cases.c.h" + #line 2115 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -2111,7 +2119,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1519 "Python/bytecodes.c" + #line 1527 "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)) { @@ -2119,12 +2127,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 2123 "Python/generated_cases.c.h" + #line 2131 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1527 "Python/bytecodes.c" + #line 1535 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2128 "Python/generated_cases.c.h" + #line 2136 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2132,17 +2140,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1533 "Python/bytecodes.c" + #line 1541 "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 2141 "Python/generated_cases.c.h" + #line 2149 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1538 "Python/bytecodes.c" + #line 1546 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2146 "Python/generated_cases.c.h" + #line 2154 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); PREDICT(CALL_FUNCTION_EX); @@ -2152,13 +2160,13 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1545 "Python/bytecodes.c" + #line 1553 "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 2162 "Python/generated_cases.c.h" + #line 2170 "Python/generated_cases.c.h" STACK_SHRINK(2); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -2170,7 +2178,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1568 "Python/bytecodes.c" + #line 1576 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2204,9 +2212,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2208 "Python/generated_cases.c.h" + #line 2216 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1602 "Python/bytecodes.c" + #line 1610 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2215,12 +2223,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2219 "Python/generated_cases.c.h" + #line 2227 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1611 "Python/bytecodes.c" + #line 1619 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2224 "Python/generated_cases.c.h" + #line 2232 "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; } @@ -2234,7 +2242,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1616 "Python/bytecodes.c" + #line 1624 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2247,7 +2255,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2251 "Python/generated_cases.c.h" + #line 2259 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2262,7 +2270,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1632 "Python/bytecodes.c" + #line 1640 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2275,7 +2283,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2279 "Python/generated_cases.c.h" + #line 2287 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2290,7 +2298,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1648 "Python/bytecodes.c" + #line 1656 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2317,7 +2325,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2321 "Python/generated_cases.c.h" + #line 2329 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2332,7 +2340,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1678 "Python/bytecodes.c" + #line 1686 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2342,7 +2350,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2346 "Python/generated_cases.c.h" + #line 2354 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2357,7 +2365,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1691 "Python/bytecodes.c" + #line 1699 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2369,7 +2377,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2373 "Python/generated_cases.c.h" + #line 2381 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2383,7 +2391,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 1706 "Python/bytecodes.c" + #line 1714 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2406,7 +2414,7 @@ new_frame->localsplus[0] = owner; JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); DISPATCH_INLINED(new_frame); - #line 2410 "Python/generated_cases.c.h" + #line 2418 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2414,7 +2422,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 1731 "Python/bytecodes.c" + #line 1739 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR); @@ -2439,7 +2447,7 @@ new_frame->localsplus[1] = Py_NewRef(name); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); DISPATCH_INLINED(new_frame); - #line 2443 "Python/generated_cases.c.h" + #line 2451 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2447,7 +2455,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 1758 "Python/bytecodes.c" + #line 1766 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2465,7 +2473,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2469 "Python/generated_cases.c.h" + #line 2477 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2476,7 +2484,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 1778 "Python/bytecodes.c" + #line 1786 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2515,7 +2523,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2519 "Python/generated_cases.c.h" + #line 2527 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2526,7 +2534,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 1819 "Python/bytecodes.c" + #line 1827 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2536,7 +2544,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2540 "Python/generated_cases.c.h" + #line 2548 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2548,7 +2556,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1838 "Python/bytecodes.c" + #line 1846 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2561,12 +2569,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2565 "Python/generated_cases.c.h" + #line 2573 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1851 "Python/bytecodes.c" + #line 1859 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2570 "Python/generated_cases.c.h" + #line 2578 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2577,7 +2585,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1855 "Python/bytecodes.c" + #line 1863 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2589,7 +2597,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2593 "Python/generated_cases.c.h" + #line 2601 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2600,7 +2608,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1870 "Python/bytecodes.c" + #line 1878 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP); DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP); @@ -2616,7 +2624,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2620 "Python/generated_cases.c.h" + #line 2628 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2627,7 +2635,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1889 "Python/bytecodes.c" + #line 1897 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2640,7 +2648,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2644 "Python/generated_cases.c.h" + #line 2652 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2651,14 +2659,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1904 "Python/bytecodes.c" + #line 1912 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 2657 "Python/generated_cases.c.h" + #line 2665 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1906 "Python/bytecodes.c" + #line 1914 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2662 "Python/generated_cases.c.h" + #line 2670 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2668,15 +2676,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1910 "Python/bytecodes.c" + #line 1918 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 2674 "Python/generated_cases.c.h" + #line 2682 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1912 "Python/bytecodes.c" + #line 1920 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = Py_NewRef((res^oparg) ? Py_True : Py_False); - #line 2680 "Python/generated_cases.c.h" + #line 2688 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2687,12 +2695,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 1917 "Python/bytecodes.c" + #line 1925 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 2693 "Python/generated_cases.c.h" + #line 2701 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1919 "Python/bytecodes.c" + #line 1927 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2700,10 +2708,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 2704 "Python/generated_cases.c.h" + #line 2712 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1927 "Python/bytecodes.c" + #line 1935 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2712,7 +2720,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 2716 "Python/generated_cases.c.h" + #line 2724 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -2722,21 +2730,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1938 "Python/bytecodes.c" + #line 1946 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 2729 "Python/generated_cases.c.h" + #line 2737 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1941 "Python/bytecodes.c" + #line 1949 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 2736 "Python/generated_cases.c.h" + #line 2744 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1946 "Python/bytecodes.c" + #line 1954 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2740 "Python/generated_cases.c.h" + #line 2748 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -2745,15 +2753,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 1950 "Python/bytecodes.c" + #line 1958 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 2752 "Python/generated_cases.c.h" + #line 2760 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 1953 "Python/bytecodes.c" + #line 1961 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2757 "Python/generated_cases.c.h" + #line 2765 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2762,29 +2770,29 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 1957 "Python/bytecodes.c" + #line 1965 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 2770 "Python/generated_cases.c.h" + #line 2778 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 1963 "Python/bytecodes.c" + #line 1971 "Python/bytecodes.c" JUMPBY(oparg); - #line 2779 "Python/generated_cases.c.h" + #line 2787 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 1967 "Python/bytecodes.c" + #line 1975 "Python/bytecodes.c" assert(oparg < INSTR_OFFSET()); JUMPBY(-oparg); - #line 2788 "Python/generated_cases.c.h" + #line 2796 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } @@ -2792,7 +2800,7 @@ TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 1973 "Python/bytecodes.c" + #line 1981 "Python/bytecodes.c" if (Py_IsTrue(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2802,9 +2810,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2806 "Python/generated_cases.c.h" + #line 2814 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 1983 "Python/bytecodes.c" + #line 1991 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -2812,14 +2820,14 @@ if (err < 0) goto pop_1_error; } } - #line 2816 "Python/generated_cases.c.h" + #line 2824 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 1993 "Python/bytecodes.c" + #line 2001 "Python/bytecodes.c" if (Py_IsFalse(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2829,9 +2837,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2833 "Python/generated_cases.c.h" + #line 2841 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2003 "Python/bytecodes.c" + #line 2011 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -2839,67 +2847,67 @@ if (err < 0) goto pop_1_error; } } - #line 2843 "Python/generated_cases.c.h" + #line 2851 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2013 "Python/bytecodes.c" + #line 2021 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 2852 "Python/generated_cases.c.h" + #line 2860 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2015 "Python/bytecodes.c" + #line 2023 "Python/bytecodes.c" JUMPBY(oparg); } else { _Py_DECREF_NO_DEALLOC(value); } - #line 2860 "Python/generated_cases.c.h" + #line 2868 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2023 "Python/bytecodes.c" + #line 2031 "Python/bytecodes.c" if (Py_IsNone(value)) { _Py_DECREF_NO_DEALLOC(value); JUMPBY(oparg); } else { - #line 2873 "Python/generated_cases.c.h" + #line 2881 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2029 "Python/bytecodes.c" + #line 2037 "Python/bytecodes.c" } - #line 2877 "Python/generated_cases.c.h" + #line 2885 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2033 "Python/bytecodes.c" + #line 2041 "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 2890 "Python/generated_cases.c.h" + #line 2898 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2042 "Python/bytecodes.c" + #line 2050 "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 2903 "Python/generated_cases.c.h" + #line 2911 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -2910,16 +2918,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2050 "Python/bytecodes.c" + #line 2058 "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 2919 "Python/generated_cases.c.h" + #line 2927 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2055 "Python/bytecodes.c" + #line 2063 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -2927,7 +2935,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_NewRef(Py_None); // Failure! } - #line 2931 "Python/generated_cases.c.h" + #line 2939 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -2936,10 +2944,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2065 "Python/bytecodes.c" + #line 2073 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = Py_NewRef(match ? Py_True : Py_False); - #line 2943 "Python/generated_cases.c.h" + #line 2951 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2949,10 +2957,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2071 "Python/bytecodes.c" + #line 2079 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = Py_NewRef(match ? Py_True : Py_False); - #line 2956 "Python/generated_cases.c.h" + #line 2964 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2963,11 +2971,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2077 "Python/bytecodes.c" + #line 2085 "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 2971 "Python/generated_cases.c.h" + #line 2979 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -2976,14 +2984,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2083 "Python/bytecodes.c" + #line 2091 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 2983 "Python/generated_cases.c.h" + #line 2991 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2086 "Python/bytecodes.c" + #line 2094 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 2987 "Python/generated_cases.c.h" + #line 2995 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -2991,7 +2999,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2090 "Python/bytecodes.c" + #line 2098 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3014,11 +3022,11 @@ if (iter == NULL) { goto error; } - #line 3018 "Python/generated_cases.c.h" + #line 3026 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2113 "Python/bytecodes.c" + #line 2121 "Python/bytecodes.c" } - #line 3022 "Python/generated_cases.c.h" + #line 3030 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3029,7 +3037,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2132 "Python/bytecodes.c" + #line 2140 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3060,7 +3068,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3064 "Python/generated_cases.c.h" + #line 3072 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3068,7 +3076,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2165 "Python/bytecodes.c" + #line 2173 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3094,14 +3102,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3098 "Python/generated_cases.c.h" + #line 3106 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2193 "Python/bytecodes.c" + #line 2201 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3121,7 +3129,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3125 "Python/generated_cases.c.h" + #line 3133 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3131,7 +3139,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2215 "Python/bytecodes.c" + #line 2223 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3151,7 +3159,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3155 "Python/generated_cases.c.h" + #line 3163 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3161,7 +3169,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2237 "Python/bytecodes.c" + #line 2245 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3179,7 +3187,7 @@ if (next == NULL) { goto error; } - #line 3183 "Python/generated_cases.c.h" + #line 3191 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3188,29 +3196,29 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2257 "Python/bytecodes.c" + #line 2265 "Python/bytecodes.c" PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, FOR_ITER); STAT_INC(FOR_ITER, hit); _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; - frame->yield_offset = oparg; + frame->return_offset = oparg; _PyFrame_StackPush(gen_frame, Py_NewRef(Py_None)); gen->gi_frame_state = FRAME_EXECUTING; gen->gi_exc_state.previous_item = tstate->exc_info; tstate->exc_info = &gen->gi_exc_state; - JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg); - assert(next_instr->op.code == END_FOR || - next_instr->op.code == INSTRUMENTED_END_FOR); + JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER); + assert(next_instr[oparg].op.code == END_FOR || + next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3207 "Python/generated_cases.c.h" + #line 3215 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2274 "Python/bytecodes.c" + #line 2282 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3233,16 +3241,16 @@ Py_DECREF(enter); goto error; } - #line 3237 "Python/generated_cases.c.h" + #line 3245 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2297 "Python/bytecodes.c" + #line 2305 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3246 "Python/generated_cases.c.h" + #line 3254 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3254,7 +3262,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2307 "Python/bytecodes.c" + #line 2315 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3280,16 +3288,16 @@ Py_DECREF(enter); goto error; } - #line 3284 "Python/generated_cases.c.h" + #line 3292 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2333 "Python/bytecodes.c" + #line 2341 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3293 "Python/generated_cases.c.h" + #line 3301 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3301,7 +3309,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2342 "Python/bytecodes.c" + #line 2350 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3322,7 +3330,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3326 "Python/generated_cases.c.h" + #line 3334 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3331,7 +3339,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2365 "Python/bytecodes.c" + #line 2373 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3341,7 +3349,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3345 "Python/generated_cases.c.h" + #line 3353 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3355,7 +3363,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 2377 "Python/bytecodes.c" + #line 2385 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3372,7 +3380,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3376 "Python/generated_cases.c.h" + #line 3384 "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; } @@ -3386,7 +3394,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2396 "Python/bytecodes.c" + #line 2404 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3396,7 +3404,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3400 "Python/generated_cases.c.h" + #line 3408 "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; } @@ -3410,7 +3418,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2408 "Python/bytecodes.c" + #line 2416 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3424,7 +3432,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3428 "Python/generated_cases.c.h" + #line 3436 "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; } @@ -3433,16 +3441,16 @@ } TARGET(KW_NAMES) { - #line 2424 "Python/bytecodes.c" + #line 2432 "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 3441 "Python/generated_cases.c.h" + #line 3449 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2430 "Python/bytecodes.c" + #line 2438 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3455,7 +3463,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3459 "Python/generated_cases.c.h" + #line 3467 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3465,7 +3473,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2475 "Python/bytecodes.c" + #line 2483 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3546,7 +3554,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3550 "Python/generated_cases.c.h" + #line 3558 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3558,7 +3566,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2562 "Python/bytecodes.c" + #line 2570 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3568,7 +3576,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3572 "Python/generated_cases.c.h" + #line 3580 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3577,7 +3585,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2574 "Python/bytecodes.c" + #line 2582 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3602,7 +3610,7 @@ STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); DISPATCH_INLINED(new_frame); - #line 3606 "Python/generated_cases.c.h" + #line 3614 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3610,7 +3618,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2601 "Python/bytecodes.c" + #line 2609 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3645,7 +3653,7 @@ STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); DISPATCH_INLINED(new_frame); - #line 3649 "Python/generated_cases.c.h" + #line 3657 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -3653,7 +3661,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2638 "Python/bytecodes.c" + #line 2646 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3663,7 +3671,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 3667 "Python/generated_cases.c.h" + #line 3675 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3676,7 +3684,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2650 "Python/bytecodes.c" + #line 2658 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3687,7 +3695,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3691 "Python/generated_cases.c.h" + #line 3699 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3701,7 +3709,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2664 "Python/bytecodes.c" + #line 2672 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3712,7 +3720,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3716 "Python/generated_cases.c.h" + #line 3724 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3726,7 +3734,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2678 "Python/bytecodes.c" + #line 2686 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3748,7 +3756,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3752 "Python/generated_cases.c.h" + #line 3760 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3762,7 +3770,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2703 "Python/bytecodes.c" + #line 2711 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3790,7 +3798,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3794 "Python/generated_cases.c.h" + #line 3802 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3804,7 +3812,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2734 "Python/bytecodes.c" + #line 2742 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3836,7 +3844,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 3840 "Python/generated_cases.c.h" + #line 3848 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3850,7 +3858,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2769 "Python/bytecodes.c" + #line 2777 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -3882,7 +3890,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3886 "Python/generated_cases.c.h" + #line 3894 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3896,7 +3904,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2804 "Python/bytecodes.c" + #line 2812 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -3921,7 +3929,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3925 "Python/generated_cases.c.h" + #line 3933 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3934,7 +3942,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2831 "Python/bytecodes.c" + #line 2839 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -3961,7 +3969,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3965 "Python/generated_cases.c.h" + #line 3973 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3973,7 +3981,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2861 "Python/bytecodes.c" + #line 2869 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -3991,14 +3999,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 3995 "Python/generated_cases.c.h" + #line 4003 "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 2881 "Python/bytecodes.c" + #line 2889 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4029,7 +4037,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4033 "Python/generated_cases.c.h" + #line 4041 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4042,7 +4050,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2915 "Python/bytecodes.c" + #line 2923 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4071,7 +4079,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4075 "Python/generated_cases.c.h" + #line 4083 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4084,7 +4092,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2947 "Python/bytecodes.c" + #line 2955 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4113,7 +4121,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4117 "Python/generated_cases.c.h" + #line 4125 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4126,7 +4134,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2979 "Python/bytecodes.c" + #line 2987 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4154,7 +4162,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4158 "Python/generated_cases.c.h" + #line 4166 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4164,9 +4172,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3010 "Python/bytecodes.c" + #line 3018 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4170 "Python/generated_cases.c.h" + #line 4178 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4175,7 +4183,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3014 "Python/bytecodes.c" + #line 3022 "Python/bytecodes.c" // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. assert(kwargs == NULL || PyDict_CheckExact(kwargs)); @@ -4218,14 +4226,14 @@ else { result = PyObject_Call(func, callargs, kwargs); } - #line 4222 "Python/generated_cases.c.h" + #line 4230 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3057 "Python/bytecodes.c" + #line 3065 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4229 "Python/generated_cases.c.h" + #line 4237 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4240,7 +4248,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 3067 "Python/bytecodes.c" + #line 3075 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4269,14 +4277,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4273 "Python/generated_cases.c.h" + #line 4281 "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 3098 "Python/bytecodes.c" + #line 3106 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4296,8 +4304,9 @@ _PyThreadState_PopFrame(tstate, frame); frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); + assert(frame->return_offset == 0); goto resume_frame; - #line 4301 "Python/generated_cases.c.h" + #line 4310 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4305,15 +4314,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3121 "Python/bytecodes.c" + #line 3130 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4311 "Python/generated_cases.c.h" + #line 4320 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3123 "Python/bytecodes.c" + #line 3132 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4317 "Python/generated_cases.c.h" + #line 4326 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4324,7 +4333,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 3127 "Python/bytecodes.c" + #line 3136 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4359,7 +4368,7 @@ Py_DECREF(value); Py_XDECREF(fmt_spec); if (result == NULL) { STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); goto pop_1_error; } - #line 4363 "Python/generated_cases.c.h" + #line 4372 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4368,10 +4377,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3164 "Python/bytecodes.c" + #line 3173 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4375 "Python/generated_cases.c.h" + #line 4384 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4383,7 +4392,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3169 "Python/bytecodes.c" + #line 3178 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4398,12 +4407,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4402 "Python/generated_cases.c.h" + #line 4411 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3184 "Python/bytecodes.c" + #line 3193 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4407 "Python/generated_cases.c.h" + #line 4416 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4413,16 +4422,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3189 "Python/bytecodes.c" + #line 3198 "Python/bytecodes.c" assert(oparg >= 2); - #line 4419 "Python/generated_cases.c.h" + #line 4428 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_LINE) { - #line 3193 "Python/bytecodes.c" + #line 3202 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _PyFrame_SetStackPointer(frame, stack_pointer); int original_opcode = _Py_call_instrumentation_line( @@ -4442,11 +4451,11 @@ } opcode = original_opcode; DISPATCH_GOTO(); - #line 4446 "Python/generated_cases.c.h" + #line 4455 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3215 "Python/bytecodes.c" + #line 3224 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4458,26 +4467,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4462 "Python/generated_cases.c.h" + #line 4471 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3229 "Python/bytecodes.c" + #line 3238 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4468 "Python/generated_cases.c.h" + #line 4477 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3233 "Python/bytecodes.c" + #line 3242 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr-oparg, PY_MONITORING_EVENT_JUMP); - #line 4475 "Python/generated_cases.c.h" + #line 4484 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3238 "Python/bytecodes.c" + #line 3247 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4486,12 +4495,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4490 "Python/generated_cases.c.h" + #line 4499 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3249 "Python/bytecodes.c" + #line 3258 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4500,12 +4509,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4504 "Python/generated_cases.c.h" + #line 4513 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3260 "Python/bytecodes.c" + #line 3269 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4518,12 +4527,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4522 "Python/generated_cases.c.h" + #line 4531 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3275 "Python/bytecodes.c" + #line 3284 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4536,30 +4545,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4540 "Python/generated_cases.c.h" + #line 4549 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3290 "Python/bytecodes.c" + #line 3299 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4551 "Python/generated_cases.c.h" + #line 4560 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3298 "Python/bytecodes.c" + #line 3307 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4558 "Python/generated_cases.c.h" + #line 4567 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3303 "Python/bytecodes.c" + #line 3312 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4565 "Python/generated_cases.c.h" + #line 4574 "Python/generated_cases.c.h" } From c86c721d3e7310d4018076f4d3dfd574e834555e Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Wed, 12 Apr 2023 20:04:08 +0100 Subject: [PATCH 2/4] Set return_offset on call, instead of resetting it on return. --- Python/bytecodes.c | 13 +- Python/ceval_macros.h | 2 +- Python/generated_cases.c.h | 715 ++++++++++++++++++------------------- 3 files changed, 364 insertions(+), 366 deletions(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 31987df0ef5bb5..7af96b4a5e324e 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -506,6 +506,7 @@ dummy_func( new_frame->localsplus[0] = container; new_frame->localsplus[1] = sub; JUMPBY(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); } @@ -638,7 +639,6 @@ dummy_func( frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); frame->prev_instr += frame->return_offset; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -658,7 +658,6 @@ dummy_func( frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); frame->prev_instr += frame->return_offset; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -675,7 +674,6 @@ dummy_func( frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); frame->prev_instr += frame->return_offset; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -696,7 +694,6 @@ dummy_func( frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); frame->prev_instr += frame->return_offset; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -894,7 +891,6 @@ dummy_func( _PyInterpreterFrame *gen_frame = frame; frame = cframe.current_frame = frame->previous; gen_frame->previous = NULL; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -913,7 +909,6 @@ dummy_func( _PyInterpreterFrame *gen_frame = frame; frame = cframe.current_frame = frame->previous; gen_frame->previous = NULL; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; } @@ -1732,6 +1727,7 @@ dummy_func( STACK_SHRINK(shrink_stack); new_frame->localsplus[0] = owner; JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); } @@ -1759,6 +1755,7 @@ dummy_func( new_frame->localsplus[0] = owner; new_frame->localsplus[1] = Py_NewRef(name); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); } @@ -2529,6 +2526,7 @@ dummy_func( goto error; } JUMPBY(INLINE_CACHE_ENTRIES_CALL); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); } /* Callable is not a normal Python function */ @@ -2602,6 +2600,7 @@ dummy_func( // Manipulate stack directly since we leave using DISPATCH_INLINED(). STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); } @@ -2639,6 +2638,7 @@ dummy_func( // Manipulate stack and cache directly since we leave using DISPATCH_INLINED(). STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); } @@ -3122,7 +3122,6 @@ dummy_func( _PyThreadState_PopFrame(tstate, frame); frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); - assert(frame->return_offset == 0); goto resume_frame; } diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index 308112c1884169..485771ac65a767 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -72,7 +72,7 @@ #endif #if USE_COMPUTED_GOTOS -# define TARGET(op) TARGET_##op: INSTRUCTION_START(op); assert(frame->return_offset == 0); +# define TARGET(op) TARGET_##op: INSTRUCTION_START(op); # define DISPATCH_GOTO() goto *opcode_targets[opcode] #else # define TARGET(op) case op: TARGET_##op: INSTRUCTION_START(op); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index e8a1eeac102e41..0928f8200ae751 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -715,16 +715,17 @@ new_frame->localsplus[0] = container; new_frame->localsplus[1] = sub; JUMPBY(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 720 "Python/generated_cases.c.h" + #line 721 "Python/generated_cases.c.h" } TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 513 "Python/bytecodes.c" + #line 514 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; - #line 728 "Python/generated_cases.c.h" + #line 729 "Python/generated_cases.c.h" STACK_SHRINK(1); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -733,13 +734,13 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 518 "Python/bytecodes.c" + #line 519 "Python/bytecodes.c" int err = PySet_Add(set, v); - #line 739 "Python/generated_cases.c.h" + #line 740 "Python/generated_cases.c.h" Py_DECREF(v); - #line 520 "Python/bytecodes.c" + #line 521 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 743 "Python/generated_cases.c.h" + #line 744 "Python/generated_cases.c.h" STACK_SHRINK(1); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -752,7 +753,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 531 "Python/bytecodes.c" + #line 532 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -767,13 +768,13 @@ #endif /* ENABLE_SPECIALIZATION */ /* container[sub] = v */ int err = PyObject_SetItem(container, sub, v); - #line 771 "Python/generated_cases.c.h" + #line 772 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); - #line 546 "Python/bytecodes.c" + #line 547 "Python/bytecodes.c" if (err) goto pop_3_error; - #line 777 "Python/generated_cases.c.h" + #line 778 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -783,7 +784,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 550 "Python/bytecodes.c" + #line 551 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -800,7 +801,7 @@ Py_DECREF(old_value); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 804 "Python/generated_cases.c.h" + #line 805 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -810,13 +811,13 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 569 "Python/bytecodes.c" + #line 570 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR); STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); Py_DECREF(dict); if (err) goto pop_3_error; - #line 820 "Python/generated_cases.c.h" + #line 821 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -825,15 +826,15 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 577 "Python/bytecodes.c" + #line 578 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); - #line 832 "Python/generated_cases.c.h" + #line 833 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 580 "Python/bytecodes.c" + #line 581 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 837 "Python/generated_cases.c.h" + #line 838 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -841,14 +842,14 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 584 "Python/bytecodes.c" + #line 585 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); - #line 848 "Python/generated_cases.c.h" + #line 849 "Python/generated_cases.c.h" Py_DECREF(value); - #line 587 "Python/bytecodes.c" + #line 588 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 852 "Python/generated_cases.c.h" + #line 853 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -857,15 +858,15 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; - #line 591 "Python/bytecodes.c" + #line 592 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); - #line 864 "Python/generated_cases.c.h" + #line 865 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); - #line 594 "Python/bytecodes.c" + #line 595 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 869 "Python/generated_cases.c.h" + #line 870 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -873,7 +874,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); - #line 598 "Python/bytecodes.c" + #line 599 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -891,12 +892,12 @@ break; } if (true) { STACK_SHRINK(oparg); goto error; } - #line 895 "Python/generated_cases.c.h" + #line 896 "Python/generated_cases.c.h" } TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; - #line 618 "Python/bytecodes.c" + #line 619 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); STACK_SHRINK(1); // Since we're not going to DISPATCH() @@ -907,12 +908,12 @@ assert(!_PyErr_Occurred(tstate)); _Py_LeaveRecursiveCallTstate(tstate); return retval; - #line 911 "Python/generated_cases.c.h" + #line 912 "Python/generated_cases.c.h" } TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 631 "Python/bytecodes.c" + #line 632 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -923,7 +924,6 @@ frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); frame->prev_instr += frame->return_offset; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; #line 930 "Python/generated_cases.c.h" @@ -946,14 +946,13 @@ frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); frame->prev_instr += frame->return_offset; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 953 "Python/generated_cases.c.h" + #line 952 "Python/generated_cases.c.h" } TARGET(RETURN_CONST) { - #line 667 "Python/bytecodes.c" + #line 666 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -965,14 +964,13 @@ frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); frame->prev_instr += frame->return_offset; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 972 "Python/generated_cases.c.h" + #line 970 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_CONST) { - #line 684 "Python/bytecodes.c" + #line 682 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -988,16 +986,15 @@ frame = cframe.current_frame = dying->previous; _PyEvalFrameClearAndPop(tstate, dying); frame->prev_instr += frame->return_offset; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 995 "Python/generated_cases.c.h" + #line 992 "Python/generated_cases.c.h" } TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; - #line 705 "Python/bytecodes.c" + #line 702 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -1010,16 +1007,16 @@ "'async for' requires an object with " "__aiter__ method, got %.100s", type->tp_name); - #line 1014 "Python/generated_cases.c.h" + #line 1011 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 718 "Python/bytecodes.c" + #line 715 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); - #line 1021 "Python/generated_cases.c.h" + #line 1018 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 723 "Python/bytecodes.c" + #line 720 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -1032,7 +1029,7 @@ Py_DECREF(iter); if (true) goto pop_1_error; } - #line 1036 "Python/generated_cases.c.h" + #line 1033 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1040,7 +1037,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; - #line 738 "Python/bytecodes.c" + #line 735 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -1084,7 +1081,7 @@ } } - #line 1088 "Python/generated_cases.c.h" + #line 1085 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = awaitable; PREDICT(LOAD_CONST); @@ -1095,16 +1092,16 @@ PREDICTED(GET_AWAITABLE); PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 785 "Python/bytecodes.c" + #line 782 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { format_awaitable_error(tstate, Py_TYPE(iterable), oparg); } - #line 1106 "Python/generated_cases.c.h" + #line 1103 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 792 "Python/bytecodes.c" + #line 789 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -1122,7 +1119,7 @@ if (iter == NULL) goto pop_1_error; - #line 1126 "Python/generated_cases.c.h" + #line 1123 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -1133,7 +1130,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; - #line 818 "Python/bytecodes.c" + #line 815 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1179,7 +1176,7 @@ } } Py_DECREF(v); - #line 1183 "Python/generated_cases.c.h" + #line 1180 "Python/generated_cases.c.h" stack_pointer[-1] = retval; next_instr += 1; DISPATCH(); @@ -1188,7 +1185,7 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 866 "Python/bytecodes.c" + #line 863 "Python/bytecodes.c" PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && Py_TYPE(gen) != &PyCoro_Type, SEND); @@ -1203,12 +1200,12 @@ tstate->exc_info = &gen->gi_exc_state; JUMPBY(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); - #line 1207 "Python/generated_cases.c.h" + #line 1204 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 883 "Python/bytecodes.c" + #line 880 "Python/bytecodes.c" assert(frame != &entry_frame); PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; @@ -1223,15 +1220,14 @@ _PyInterpreterFrame *gen_frame = frame; frame = cframe.current_frame = frame->previous; gen_frame->previous = NULL; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1230 "Python/generated_cases.c.h" + #line 1226 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 903 "Python/bytecodes.c" + #line 899 "Python/bytecodes.c" // NOTE: It's important that YIELD_VALUE never raises an exception! // The compiler treats any exception raised here as a failed close() // or throw() call. @@ -1245,18 +1241,17 @@ _PyInterpreterFrame *gen_frame = frame; frame = cframe.current_frame = frame->previous; gen_frame->previous = NULL; - frame->return_offset = 0; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1252 "Python/generated_cases.c.h" + #line 1247 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 922 "Python/bytecodes.c" + #line 917 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); - #line 1260 "Python/generated_cases.c.h" + #line 1255 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1264,7 +1259,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 927 "Python/bytecodes.c" + #line 922 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1282,26 +1277,26 @@ Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1286 "Python/generated_cases.c.h" + #line 1281 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 947 "Python/bytecodes.c" + #line 942 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1295 "Python/generated_cases.c.h" + #line 1290 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 950 "Python/bytecodes.c" + #line 945 "Python/bytecodes.c" } else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1305 "Python/generated_cases.c.h" + #line 1300 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1312,23 +1307,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 959 "Python/bytecodes.c" + #line 954 "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 1321 "Python/generated_cases.c.h" + #line 1316 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 964 "Python/bytecodes.c" + #line 959 "Python/bytecodes.c" none = Py_NewRef(Py_None); } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1332 "Python/generated_cases.c.h" + #line 1327 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1337,9 +1332,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 973 "Python/bytecodes.c" + #line 968 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1343 "Python/generated_cases.c.h" + #line 1338 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1347,7 +1342,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 977 "Python/bytecodes.c" + #line 972 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1369,7 +1364,7 @@ if (true) goto error; } } - #line 1373 "Python/generated_cases.c.h" + #line 1368 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1377,33 +1372,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1001 "Python/bytecodes.c" + #line 996 "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 1388 "Python/generated_cases.c.h" + #line 1383 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1008 "Python/bytecodes.c" + #line 1003 "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 1397 "Python/generated_cases.c.h" + #line 1392 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1015 "Python/bytecodes.c" + #line 1010 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1401 "Python/generated_cases.c.h" + #line 1396 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 1019 "Python/bytecodes.c" + #line 1014 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1420,7 +1415,7 @@ name); goto error; } - #line 1424 "Python/generated_cases.c.h" + #line 1419 "Python/generated_cases.c.h" DISPATCH(); } @@ -1428,7 +1423,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1045 "Python/bytecodes.c" + #line 1040 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1441,11 +1436,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1445 "Python/generated_cases.c.h" + #line 1440 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1058 "Python/bytecodes.c" + #line 1053 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1449 "Python/generated_cases.c.h" + #line 1444 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1455,14 +1450,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1062 "Python/bytecodes.c" + #line 1057 "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 1466 "Python/generated_cases.c.h" + #line 1461 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1473,7 +1468,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1072 "Python/bytecodes.c" + #line 1067 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1481,7 +1476,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1485 "Python/generated_cases.c.h" + #line 1480 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1492,7 +1487,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1083 "Python/bytecodes.c" + #line 1078 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1500,7 +1495,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1504 "Python/generated_cases.c.h" + #line 1499 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1510,15 +1505,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1094 "Python/bytecodes.c" + #line 1089 "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 1518 "Python/generated_cases.c.h" + #line 1513 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1098 "Python/bytecodes.c" + #line 1093 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1522 "Python/generated_cases.c.h" + #line 1517 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1529,7 +1524,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1109 "Python/bytecodes.c" + #line 1104 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg); @@ -1545,12 +1540,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1549 "Python/generated_cases.c.h" + #line 1544 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1125 "Python/bytecodes.c" + #line 1120 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1554 "Python/generated_cases.c.h" + #line 1549 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1558,34 +1553,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1129 "Python/bytecodes.c" + #line 1124 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); - #line 1565 "Python/generated_cases.c.h" + #line 1560 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1132 "Python/bytecodes.c" + #line 1127 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1569 "Python/generated_cases.c.h" + #line 1564 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1136 "Python/bytecodes.c" + #line 1131 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1579 "Python/generated_cases.c.h" + #line 1574 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1139 "Python/bytecodes.c" + #line 1134 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1583 "Python/generated_cases.c.h" + #line 1578 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 1143 "Python/bytecodes.c" + #line 1138 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1597,13 +1592,13 @@ } goto error; } - #line 1601 "Python/generated_cases.c.h" + #line 1596 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_NAME) { PyObject *v; - #line 1157 "Python/bytecodes.c" + #line 1152 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *locals = LOCALS(); if (locals == NULL) { @@ -1662,7 +1657,7 @@ } } } - #line 1666 "Python/generated_cases.c.h" + #line 1661 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = v; DISPATCH(); @@ -1673,7 +1668,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1224 "Python/bytecodes.c" + #line 1219 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1725,7 +1720,7 @@ } } null = NULL; - #line 1729 "Python/generated_cases.c.h" + #line 1724 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -1739,7 +1734,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1278 "Python/bytecodes.c" + #line 1273 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -1750,7 +1745,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1754 "Python/generated_cases.c.h" + #line 1749 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1765,7 +1760,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 1291 "Python/bytecodes.c" + #line 1286 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -1780,7 +1775,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1784 "Python/generated_cases.c.h" + #line 1779 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1790,16 +1785,16 @@ } TARGET(DELETE_FAST) { - #line 1308 "Python/bytecodes.c" + #line 1303 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 1798 "Python/generated_cases.c.h" + #line 1793 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1314 "Python/bytecodes.c" + #line 1309 "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); @@ -1808,12 +1803,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 1812 "Python/generated_cases.c.h" + #line 1807 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1325 "Python/bytecodes.c" + #line 1320 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -1824,13 +1819,13 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 1828 "Python/generated_cases.c.h" + #line 1823 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_CLASSDEREF) { PyObject *value; - #line 1338 "Python/bytecodes.c" + #line 1333 "Python/bytecodes.c" PyObject *name, *locals = LOCALS(); assert(locals); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -1862,7 +1857,7 @@ } Py_INCREF(value); } - #line 1866 "Python/generated_cases.c.h" + #line 1861 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1870,7 +1865,7 @@ TARGET(LOAD_DEREF) { PyObject *value; - #line 1372 "Python/bytecodes.c" + #line 1367 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -1878,7 +1873,7 @@ if (true) goto error; } Py_INCREF(value); - #line 1882 "Python/generated_cases.c.h" + #line 1877 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1886,18 +1881,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1382 "Python/bytecodes.c" + #line 1377 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 1895 "Python/generated_cases.c.h" + #line 1890 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1389 "Python/bytecodes.c" + #line 1384 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -1908,22 +1903,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 1912 "Python/generated_cases.c.h" + #line 1907 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1402 "Python/bytecodes.c" + #line 1397 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 1921 "Python/generated_cases.c.h" + #line 1916 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1404 "Python/bytecodes.c" + #line 1399 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 1927 "Python/generated_cases.c.h" + #line 1922 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -1933,10 +1928,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1408 "Python/bytecodes.c" + #line 1403 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 1940 "Python/generated_cases.c.h" + #line 1935 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -1946,10 +1941,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1413 "Python/bytecodes.c" + #line 1408 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 1953 "Python/generated_cases.c.h" + #line 1948 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -1959,7 +1954,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1418 "Python/bytecodes.c" + #line 1413 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -1970,13 +1965,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 1974 "Python/generated_cases.c.h" + #line 1969 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1429 "Python/bytecodes.c" + #line 1424 "Python/bytecodes.c" if (true) goto pop_1_error; } Py_DECREF(none_val); - #line 1980 "Python/generated_cases.c.h" + #line 1975 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -1985,13 +1980,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1436 "Python/bytecodes.c" + #line 1431 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); - #line 1991 "Python/generated_cases.c.h" + #line 1986 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1438 "Python/bytecodes.c" + #line 1433 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 1995 "Python/generated_cases.c.h" + #line 1990 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1999,7 +1994,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1442 "Python/bytecodes.c" + #line 1437 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2014,7 +2009,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 2018 "Python/generated_cases.c.h" + #line 2013 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -2024,7 +2019,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1459 "Python/bytecodes.c" + #line 1454 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2032,13 +2027,13 @@ if (map == NULL) goto error; - #line 2036 "Python/generated_cases.c.h" + #line 2031 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1467 "Python/bytecodes.c" + #line 1462 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 2042 "Python/generated_cases.c.h" + #line 2037 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -2046,7 +2041,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1471 "Python/bytecodes.c" + #line 1466 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2086,7 +2081,7 @@ Py_DECREF(ann_dict); } } - #line 2090 "Python/generated_cases.c.h" + #line 2085 "Python/generated_cases.c.h" DISPATCH(); } @@ -2094,7 +2089,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1513 "Python/bytecodes.c" + #line 1508 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2104,14 +2099,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 2108 "Python/generated_cases.c.h" + #line 2103 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1523 "Python/bytecodes.c" + #line 1518 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 2115 "Python/generated_cases.c.h" + #line 2110 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -2119,7 +2114,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1527 "Python/bytecodes.c" + #line 1522 "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)) { @@ -2127,12 +2122,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 2131 "Python/generated_cases.c.h" + #line 2126 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1535 "Python/bytecodes.c" + #line 1530 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2136 "Python/generated_cases.c.h" + #line 2131 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2140,17 +2135,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1541 "Python/bytecodes.c" + #line 1536 "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 2149 "Python/generated_cases.c.h" + #line 2144 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1546 "Python/bytecodes.c" + #line 1541 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2154 "Python/generated_cases.c.h" + #line 2149 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); PREDICT(CALL_FUNCTION_EX); @@ -2160,13 +2155,13 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1553 "Python/bytecodes.c" + #line 1548 "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 2170 "Python/generated_cases.c.h" + #line 2165 "Python/generated_cases.c.h" STACK_SHRINK(2); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -2178,7 +2173,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1576 "Python/bytecodes.c" + #line 1571 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2212,9 +2207,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2216 "Python/generated_cases.c.h" + #line 2211 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1610 "Python/bytecodes.c" + #line 1605 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2223,12 +2218,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2227 "Python/generated_cases.c.h" + #line 2222 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1619 "Python/bytecodes.c" + #line 1614 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2232 "Python/generated_cases.c.h" + #line 2227 "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; } @@ -2242,7 +2237,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1624 "Python/bytecodes.c" + #line 1619 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2255,7 +2250,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2259 "Python/generated_cases.c.h" + #line 2254 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2270,7 +2265,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1640 "Python/bytecodes.c" + #line 1635 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2283,7 +2278,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2287 "Python/generated_cases.c.h" + #line 2282 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2298,7 +2293,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1656 "Python/bytecodes.c" + #line 1651 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2325,7 +2320,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2329 "Python/generated_cases.c.h" + #line 2324 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2340,7 +2335,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1686 "Python/bytecodes.c" + #line 1681 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2350,7 +2345,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2354 "Python/generated_cases.c.h" + #line 2349 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2365,7 +2360,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1699 "Python/bytecodes.c" + #line 1694 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2377,7 +2372,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2381 "Python/generated_cases.c.h" + #line 2376 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2391,7 +2386,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 1714 "Python/bytecodes.c" + #line 1709 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2413,8 +2408,9 @@ STACK_SHRINK(shrink_stack); new_frame->localsplus[0] = owner; JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2418 "Python/generated_cases.c.h" + #line 2414 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2422,7 +2418,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 1739 "Python/bytecodes.c" + #line 1735 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR); @@ -2446,8 +2442,9 @@ new_frame->localsplus[0] = owner; new_frame->localsplus[1] = Py_NewRef(name); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2451 "Python/generated_cases.c.h" + #line 2448 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2455,7 +2452,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 1766 "Python/bytecodes.c" + #line 1763 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2473,7 +2470,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2477 "Python/generated_cases.c.h" + #line 2474 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2484,7 +2481,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 1786 "Python/bytecodes.c" + #line 1783 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2523,7 +2520,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2527 "Python/generated_cases.c.h" + #line 2524 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2534,7 +2531,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 1827 "Python/bytecodes.c" + #line 1824 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2544,7 +2541,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2548 "Python/generated_cases.c.h" + #line 2545 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2556,7 +2553,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1846 "Python/bytecodes.c" + #line 1843 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2569,12 +2566,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2573 "Python/generated_cases.c.h" + #line 2570 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1859 "Python/bytecodes.c" + #line 1856 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2578 "Python/generated_cases.c.h" + #line 2575 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2585,7 +2582,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1863 "Python/bytecodes.c" + #line 1860 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2597,7 +2594,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2601 "Python/generated_cases.c.h" + #line 2598 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2608,7 +2605,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1878 "Python/bytecodes.c" + #line 1875 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP); DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP); @@ -2624,7 +2621,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2628 "Python/generated_cases.c.h" + #line 2625 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2635,7 +2632,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1897 "Python/bytecodes.c" + #line 1894 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2648,7 +2645,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2652 "Python/generated_cases.c.h" + #line 2649 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2659,14 +2656,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1912 "Python/bytecodes.c" + #line 1909 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 2665 "Python/generated_cases.c.h" + #line 2662 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1914 "Python/bytecodes.c" + #line 1911 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2670 "Python/generated_cases.c.h" + #line 2667 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2676,15 +2673,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1918 "Python/bytecodes.c" + #line 1915 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 2682 "Python/generated_cases.c.h" + #line 2679 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1920 "Python/bytecodes.c" + #line 1917 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = Py_NewRef((res^oparg) ? Py_True : Py_False); - #line 2688 "Python/generated_cases.c.h" + #line 2685 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2695,12 +2692,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 1925 "Python/bytecodes.c" + #line 1922 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 2701 "Python/generated_cases.c.h" + #line 2698 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1927 "Python/bytecodes.c" + #line 1924 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2708,10 +2705,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 2712 "Python/generated_cases.c.h" + #line 2709 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1935 "Python/bytecodes.c" + #line 1932 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2720,7 +2717,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 2724 "Python/generated_cases.c.h" + #line 2721 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -2730,21 +2727,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1946 "Python/bytecodes.c" + #line 1943 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 2737 "Python/generated_cases.c.h" + #line 2734 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1949 "Python/bytecodes.c" + #line 1946 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 2744 "Python/generated_cases.c.h" + #line 2741 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1954 "Python/bytecodes.c" + #line 1951 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2748 "Python/generated_cases.c.h" + #line 2745 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -2753,15 +2750,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 1958 "Python/bytecodes.c" + #line 1955 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 2760 "Python/generated_cases.c.h" + #line 2757 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 1961 "Python/bytecodes.c" + #line 1958 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2765 "Python/generated_cases.c.h" + #line 2762 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2770,29 +2767,29 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 1965 "Python/bytecodes.c" + #line 1962 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 2778 "Python/generated_cases.c.h" + #line 2775 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 1971 "Python/bytecodes.c" + #line 1968 "Python/bytecodes.c" JUMPBY(oparg); - #line 2787 "Python/generated_cases.c.h" + #line 2784 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 1975 "Python/bytecodes.c" + #line 1972 "Python/bytecodes.c" assert(oparg < INSTR_OFFSET()); JUMPBY(-oparg); - #line 2796 "Python/generated_cases.c.h" + #line 2793 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } @@ -2800,7 +2797,7 @@ TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 1981 "Python/bytecodes.c" + #line 1978 "Python/bytecodes.c" if (Py_IsTrue(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2810,9 +2807,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2814 "Python/generated_cases.c.h" + #line 2811 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 1991 "Python/bytecodes.c" + #line 1988 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -2820,14 +2817,14 @@ if (err < 0) goto pop_1_error; } } - #line 2824 "Python/generated_cases.c.h" + #line 2821 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2001 "Python/bytecodes.c" + #line 1998 "Python/bytecodes.c" if (Py_IsFalse(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2837,9 +2834,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2841 "Python/generated_cases.c.h" + #line 2838 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2011 "Python/bytecodes.c" + #line 2008 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -2847,67 +2844,67 @@ if (err < 0) goto pop_1_error; } } - #line 2851 "Python/generated_cases.c.h" + #line 2848 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2021 "Python/bytecodes.c" + #line 2018 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 2860 "Python/generated_cases.c.h" + #line 2857 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2023 "Python/bytecodes.c" + #line 2020 "Python/bytecodes.c" JUMPBY(oparg); } else { _Py_DECREF_NO_DEALLOC(value); } - #line 2868 "Python/generated_cases.c.h" + #line 2865 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2031 "Python/bytecodes.c" + #line 2028 "Python/bytecodes.c" if (Py_IsNone(value)) { _Py_DECREF_NO_DEALLOC(value); JUMPBY(oparg); } else { - #line 2881 "Python/generated_cases.c.h" + #line 2878 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2037 "Python/bytecodes.c" + #line 2034 "Python/bytecodes.c" } - #line 2885 "Python/generated_cases.c.h" + #line 2882 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2041 "Python/bytecodes.c" + #line 2038 "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 2898 "Python/generated_cases.c.h" + #line 2895 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2050 "Python/bytecodes.c" + #line 2047 "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 2911 "Python/generated_cases.c.h" + #line 2908 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -2918,16 +2915,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2058 "Python/bytecodes.c" + #line 2055 "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 2927 "Python/generated_cases.c.h" + #line 2924 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2063 "Python/bytecodes.c" + #line 2060 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -2935,7 +2932,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_NewRef(Py_None); // Failure! } - #line 2939 "Python/generated_cases.c.h" + #line 2936 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -2944,10 +2941,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2073 "Python/bytecodes.c" + #line 2070 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = Py_NewRef(match ? Py_True : Py_False); - #line 2951 "Python/generated_cases.c.h" + #line 2948 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2957,10 +2954,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2079 "Python/bytecodes.c" + #line 2076 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = Py_NewRef(match ? Py_True : Py_False); - #line 2964 "Python/generated_cases.c.h" + #line 2961 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2971,11 +2968,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2085 "Python/bytecodes.c" + #line 2082 "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 2979 "Python/generated_cases.c.h" + #line 2976 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -2984,14 +2981,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2091 "Python/bytecodes.c" + #line 2088 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 2991 "Python/generated_cases.c.h" + #line 2988 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2094 "Python/bytecodes.c" + #line 2091 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 2995 "Python/generated_cases.c.h" + #line 2992 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -2999,7 +2996,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2098 "Python/bytecodes.c" + #line 2095 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3022,11 +3019,11 @@ if (iter == NULL) { goto error; } - #line 3026 "Python/generated_cases.c.h" + #line 3023 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2121 "Python/bytecodes.c" + #line 2118 "Python/bytecodes.c" } - #line 3030 "Python/generated_cases.c.h" + #line 3027 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3037,7 +3034,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2140 "Python/bytecodes.c" + #line 2137 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3068,7 +3065,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3072 "Python/generated_cases.c.h" + #line 3069 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3076,7 +3073,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2173 "Python/bytecodes.c" + #line 2170 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3102,14 +3099,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3106 "Python/generated_cases.c.h" + #line 3103 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2201 "Python/bytecodes.c" + #line 2198 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3129,7 +3126,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3133 "Python/generated_cases.c.h" + #line 3130 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3139,7 +3136,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2223 "Python/bytecodes.c" + #line 2220 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3159,7 +3156,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3163 "Python/generated_cases.c.h" + #line 3160 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3169,7 +3166,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2245 "Python/bytecodes.c" + #line 2242 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3187,7 +3184,7 @@ if (next == NULL) { goto error; } - #line 3191 "Python/generated_cases.c.h" + #line 3188 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3196,7 +3193,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2265 "Python/bytecodes.c" + #line 2262 "Python/bytecodes.c" PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, FOR_ITER); @@ -3211,14 +3208,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3215 "Python/generated_cases.c.h" + #line 3212 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2282 "Python/bytecodes.c" + #line 2279 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3241,16 +3238,16 @@ Py_DECREF(enter); goto error; } - #line 3245 "Python/generated_cases.c.h" + #line 3242 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2305 "Python/bytecodes.c" + #line 2302 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3254 "Python/generated_cases.c.h" + #line 3251 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3262,7 +3259,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2315 "Python/bytecodes.c" + #line 2312 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3288,16 +3285,16 @@ Py_DECREF(enter); goto error; } - #line 3292 "Python/generated_cases.c.h" + #line 3289 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2341 "Python/bytecodes.c" + #line 2338 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3301 "Python/generated_cases.c.h" + #line 3298 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3309,7 +3306,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2350 "Python/bytecodes.c" + #line 2347 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3330,7 +3327,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3334 "Python/generated_cases.c.h" + #line 3331 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3339,7 +3336,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2373 "Python/bytecodes.c" + #line 2370 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3349,7 +3346,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3353 "Python/generated_cases.c.h" + #line 3350 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3363,7 +3360,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 2385 "Python/bytecodes.c" + #line 2382 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3380,7 +3377,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3384 "Python/generated_cases.c.h" + #line 3381 "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; } @@ -3394,7 +3391,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2404 "Python/bytecodes.c" + #line 2401 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3404,7 +3401,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3408 "Python/generated_cases.c.h" + #line 3405 "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; } @@ -3418,7 +3415,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2416 "Python/bytecodes.c" + #line 2413 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3432,7 +3429,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3436 "Python/generated_cases.c.h" + #line 3433 "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; } @@ -3441,16 +3438,16 @@ } TARGET(KW_NAMES) { - #line 2432 "Python/bytecodes.c" + #line 2429 "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 3449 "Python/generated_cases.c.h" + #line 3446 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2438 "Python/bytecodes.c" + #line 2435 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3463,7 +3460,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3467 "Python/generated_cases.c.h" + #line 3464 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3473,7 +3470,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2483 "Python/bytecodes.c" + #line 2480 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3523,6 +3520,7 @@ goto error; } JUMPBY(INLINE_CACHE_ENTRIES_CALL); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); } /* Callable is not a normal Python function */ @@ -3554,7 +3552,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3558 "Python/generated_cases.c.h" + #line 3556 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3566,7 +3564,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2570 "Python/bytecodes.c" + #line 2568 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3576,7 +3574,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3580 "Python/generated_cases.c.h" + #line 3578 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3585,7 +3583,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2582 "Python/bytecodes.c" + #line 2580 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3609,8 +3607,9 @@ // Manipulate stack directly since we leave using DISPATCH_INLINED(). STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3614 "Python/generated_cases.c.h" + #line 3613 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3618,7 +3617,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2609 "Python/bytecodes.c" + #line 2608 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3652,6 +3651,7 @@ // Manipulate stack and cache directly since we leave using DISPATCH_INLINED(). STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); + frame->return_offset = 0; DISPATCH_INLINED(new_frame); #line 3657 "Python/generated_cases.c.h" } @@ -4304,9 +4304,8 @@ _PyThreadState_PopFrame(tstate, frame); frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); - assert(frame->return_offset == 0); goto resume_frame; - #line 4310 "Python/generated_cases.c.h" + #line 4309 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4314,15 +4313,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3130 "Python/bytecodes.c" + #line 3129 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4320 "Python/generated_cases.c.h" + #line 4319 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3132 "Python/bytecodes.c" + #line 3131 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4326 "Python/generated_cases.c.h" + #line 4325 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4333,7 +4332,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 3136 "Python/bytecodes.c" + #line 3135 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4368,7 +4367,7 @@ Py_DECREF(value); Py_XDECREF(fmt_spec); if (result == NULL) { STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); goto pop_1_error; } - #line 4372 "Python/generated_cases.c.h" + #line 4371 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4377,10 +4376,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3173 "Python/bytecodes.c" + #line 3172 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4384 "Python/generated_cases.c.h" + #line 4383 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4392,7 +4391,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3178 "Python/bytecodes.c" + #line 3177 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4407,12 +4406,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4411 "Python/generated_cases.c.h" + #line 4410 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3193 "Python/bytecodes.c" + #line 3192 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4416 "Python/generated_cases.c.h" + #line 4415 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4422,16 +4421,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3198 "Python/bytecodes.c" + #line 3197 "Python/bytecodes.c" assert(oparg >= 2); - #line 4428 "Python/generated_cases.c.h" + #line 4427 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_LINE) { - #line 3202 "Python/bytecodes.c" + #line 3201 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _PyFrame_SetStackPointer(frame, stack_pointer); int original_opcode = _Py_call_instrumentation_line( @@ -4451,11 +4450,11 @@ } opcode = original_opcode; DISPATCH_GOTO(); - #line 4455 "Python/generated_cases.c.h" + #line 4454 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3224 "Python/bytecodes.c" + #line 3223 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4467,26 +4466,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4471 "Python/generated_cases.c.h" + #line 4470 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3238 "Python/bytecodes.c" + #line 3237 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4477 "Python/generated_cases.c.h" + #line 4476 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3242 "Python/bytecodes.c" + #line 3241 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr-oparg, PY_MONITORING_EVENT_JUMP); - #line 4484 "Python/generated_cases.c.h" + #line 4483 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3247 "Python/bytecodes.c" + #line 3246 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4495,12 +4494,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4499 "Python/generated_cases.c.h" + #line 4498 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3258 "Python/bytecodes.c" + #line 3257 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4509,12 +4508,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4513 "Python/generated_cases.c.h" + #line 4512 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3269 "Python/bytecodes.c" + #line 3268 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4527,12 +4526,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4531 "Python/generated_cases.c.h" + #line 4530 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3284 "Python/bytecodes.c" + #line 3283 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4545,30 +4544,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4549 "Python/generated_cases.c.h" + #line 4548 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3299 "Python/bytecodes.c" + #line 3298 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4560 "Python/generated_cases.c.h" + #line 4559 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3307 "Python/bytecodes.c" + #line 3306 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4567 "Python/generated_cases.c.h" + #line 4566 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3312 "Python/bytecodes.c" + #line 3311 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4574 "Python/generated_cases.c.h" + #line 4573 "Python/generated_cases.c.h" } From b4afef3459c4275cf471fc3ea772b3a2c4bfb461 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Wed, 12 Apr 2023 20:19:01 +0100 Subject: [PATCH 3/4] Add news --- .../2023-04-12-20-18-51.gh-issue-103488.vYvlHD.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-18-51.gh-issue-103488.vYvlHD.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-18-51.gh-issue-103488.vYvlHD.rst b/Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-18-51.gh-issue-103488.vYvlHD.rst new file mode 100644 index 00000000000000..e7daa104e57105 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-18-51.gh-issue-103488.vYvlHD.rst @@ -0,0 +1,3 @@ +Change the internal offset distinguishing yield and return target addresses, +so that the instruction pointer is correct for exception handling and other +stack unwinding. From 18fad8020e81c83e5104a1bbf224b0673b351959 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Thu, 13 Apr 2023 00:12:36 +0100 Subject: [PATCH 4/4] Add explanatory comment for return_offset. --- Include/internal/pycore_frame.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Include/internal/pycore_frame.h b/Include/internal/pycore_frame.h index 8d5cec038edbcb..20d48d20362571 100644 --- a/Include/internal/pycore_frame.h +++ b/Include/internal/pycore_frame.h @@ -61,6 +61,12 @@ typedef struct _PyInterpreterFrame { // over, or (in the case of a newly-created frame) a totally invalid value: _Py_CODEUNIT *prev_instr; int stacktop; /* Offset of TOS from localsplus */ + /* The return_offset determines where a `RETURN` should go in the caller, + * relative to `prev_instr`. + * It is only meaningful to the callee, + * so it needs to be set in any CALL (to a Python function) + * or SEND (to a coroutine or generator). + * If there is no callee, then it is meaningless. */ uint16_t return_offset; char owner; /* Locals and stack */