From 93d4169058d90cbbbd5218a8815a83278b9f9472 Mon Sep 17 00:00:00 2001 From: Jacob Bower Date: Thu, 25 Jul 2024 20:40:18 -0700 Subject: [PATCH] Add ability to set awaiters on coroutines and futures Summary: This is a redo of D57072594 but building on the changes in the diffs below to avoid ABI breakage. Reviewed By: alexmalyshev Differential Revision: D60066502 fbshipit-source-id: 66d4345f7c61e72c86badc6eb8ae424b4c4f7a02 --- Include/cpython/genobject.h | 11 + Lib/asyncio/tasks.py | 63 ++++ Lib/test/test_asyncgen.py | 25 ++ Lib/test/test_asyncio/test_tasks.py | 86 +++++ Lib/test/test_coroutines.py | 58 ++++ Misc/ACKS | 1 + Modules/_asynciomodule.c | 78 ++++- Objects/genobject.c | 107 ++++-- Python/bytecodes.c | 8 + Python/generated_cases.c.h | 512 ++++++++++++++++++++++++++++ 10 files changed, 926 insertions(+), 23 deletions(-) diff --git a/Include/cpython/genobject.h b/Include/cpython/genobject.h index f902d3d75f9..2dfa29954f2 100644 --- a/Include/cpython/genobject.h +++ b/Include/cpython/genobject.h @@ -7,6 +7,17 @@ extern "C" { #endif +static inline void Ci_PyAwaitable_SetAwaiter(PyObject *receiver, PyObject *awaiter) { + PyTypeObject *ty = Py_TYPE(receiver); + if (!PyType_HasFeature(ty, Ci_TPFLAGS_HAVE_AM_EXTRA)) { + return; + } + Ci_AsyncMethodsWithExtra *ame = (Ci_AsyncMethodsWithExtra *)ty->tp_as_async; + if ((ame != NULL) && (ame->ame_setawaiter != NULL)) { + ame->ame_setawaiter(receiver, awaiter); + } +} + /* --- Generators --------------------------------------------------------- */ /* _PyGenObject_HEAD defines the initial segment of generator diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 881637f660e..9a852a3d5e5 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -8,6 +8,7 @@ 'current_task', 'all_tasks', 'create_eager_task_factory', 'eager_task_factory', '_register_task', '_unregister_task', '_enter_task', '_leave_task', + 'get_async_stack', ) import concurrent.futures @@ -16,6 +17,7 @@ import inspect import itertools import types +import sys import warnings import weakref from types import GenericAlias @@ -732,6 +734,11 @@ def cancel(self, msg=None): self._cancel_requested = True return ret + def __set_awaiter__(self, awaiter): + for child in self._children: + if hasattr(child, "__set_awaiter__"): + child.__set_awaiter__(awaiter) + def gather(*coros_or_futures, return_exceptions=False): """Return a future aggregating results from the given coroutines/futures. @@ -956,6 +963,62 @@ def callback(): return future +def get_async_stack(): + """Return the async call stack for the currently executing task as a list of + frames, with the most recent frame last. + The async call stack consists of the call stack for the currently executing + task, if any, plus the call stack formed by the transitive set of coroutines/async + generators awaiting the current task. + Consider the following example, where T represents a task, C represents + a coroutine, and A '->' B indicates A is awaiting B. + T0 +---> T1 + | | | + C0 | C2 + | | | + v | v + C1 | C3 + | | + +-----| + The await stack from C3 would be C3, C2, C1, C0. In contrast, the + synchronous call stack while C3 is executing is only C3, C2. + """ + if not hasattr(sys, "_getframe"): + return [] + + task = current_task() + coro = task.get_coro() + coro_frame = coro.cr_frame + + # Get the active portion of the stack + stack = [] + frame = sys._getframe().f_back + while frame is not None: + stack.append(frame) + if frame is coro_frame: + break + frame = frame.f_back + assert frame is coro_frame + + # Get the suspended portion of the stack + awaiter = coro.cr_awaiter + while awaiter is not None: + if hasattr(awaiter, "cr_frame"): + stack.append(awaiter.cr_frame) + awaiter = awaiter.cr_awaiter + elif hasattr(awaiter, "ag_frame"): + stack.append(awaiter.ag_frame) + awaiter = awaiter.ag_awaiter + else: + raise ValueError(f"Unexpected awaiter {awaiter}") + + stack.reverse() + return stack + + +# WeakSet containing all alive tasks. +_all_tasks = weakref.WeakSet() + + def create_eager_task_factory(custom_task_constructor): """Create a function suitable for use as a task factory on an event-loop. diff --git a/Lib/test/test_asyncgen.py b/Lib/test/test_asyncgen.py index 9e199806da6..6990ff9b9ba 100644 --- a/Lib/test/test_asyncgen.py +++ b/Lib/test/test_asyncgen.py @@ -1903,5 +1903,30 @@ async def run(): self.loop.run_until_complete(run()) +class AsyncGeneratorAwaiterTest(unittest.TestCase): + def setUp(self): + self.loop = asyncio.new_event_loop() + asyncio.set_event_loop(None) + + def tearDown(self): + self.loop.close() + self.loop = None + asyncio.set_event_loop_policy(None) + + def test_basic_await(self): + async def async_gen(): + self.assertIs(agen_obj.ag_awaiter, awaiter_obj) + yield 10 + + async def awaiter(agen): + async for x in agen: + pass + + agen_obj = async_gen() + awaiter_obj = awaiter(agen_obj) + self.assertIsNone(agen_obj.ag_awaiter) + self.loop.run_until_complete(awaiter_obj) + + if __name__ == "__main__": unittest.main() diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 72dc2195547..16d899ef4aa 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2489,6 +2489,24 @@ def test_get_context(self): finally: loop.close() + def test_get_awaiter(self): + ctask = getattr(tasks, '_CTask', None) + if ctask is None or not issubclass(self.Task, ctask): + self.skipTest("Only subclasses of _CTask set cr_awaiter on wrapped coroutines") + + async def coro(): + self.assertIs(coro_obj.cr_awaiter, awaiter_obj) + return "ok" + + async def awaiter(coro): + task = self.loop.create_task(coro) + return await task + + coro_obj = coro() + awaiter_obj = awaiter(coro_obj) + self.assertIsNone(coro_obj.cr_awaiter) + self.assertEqual(self.loop.run_until_complete(awaiter_obj), "ok") + self.assertIsNone(coro_obj.cr_awaiter) def add_subclass_tests(cls): BaseTask = cls.Task @@ -3237,6 +3255,22 @@ async def coro(s): # NameError should not happen: self.one_loop.call_exception_handler.assert_not_called() + def test_propagate_awaiter(self): + async def coro(idx): + self.assertIs(coro_objs[idx].cr_awaiter, awaiter_obj) + return "ok" + + async def awaiter(coros): + tasks = [self.one_loop.create_task(c) for c in coros] + return await asyncio.gather(*tasks) + + coro_objs = [coro(0), coro(1)] + awaiter_obj = awaiter(coro_objs) + self.assertIsNone(coro_objs[0].cr_awaiter) + self.assertIsNone(coro_objs[1].cr_awaiter) + self.assertEqual(self.one_loop.run_until_complete(awaiter_obj), ["ok", "ok"]) + self.assertIsNone(coro_objs[0].cr_awaiter) + self.assertIsNone(coro_objs[1].cr_awaiter) class RunCoroutineThreadsafeTests(test_utils.TestCase): """Test case for asyncio.run_coroutine_threadsafe.""" @@ -3449,5 +3483,57 @@ def tearDown(self): super().tearDown() + +class GetAsyncStackTests(test_utils.TestCase): + def setUp(self): + self.loop = asyncio.new_event_loop() + asyncio.set_event_loop(None) + + def tearDown(self): + self.loop.close() + self.loop = None + asyncio.set_event_loop_policy(None) + + def check_stack(self, frames, expected_funcs): + given = [f.f_code for f in frames] + expected = [f.__code__ for f in expected_funcs] + self.assertEqual(given, expected) + + def test_single_task(self): + async def coro(): + await coro2() + + async def coro2(): + stack = asyncio.get_async_stack() + self.check_stack(stack, [coro, coro2]) + + self.loop.run_until_complete(coro()) + + def test_cross_tasks(self): + async def coro(): + t = asyncio.ensure_future(coro2()) + await t + + async def coro2(): + t = asyncio.ensure_future(coro3()) + await t + + async def coro3(): + stack = asyncio.get_async_stack() + self.check_stack(stack, [coro, coro2, coro3]) + + self.loop.run_until_complete(coro()) + + def test_cross_gather(self): + async def coro(): + await asyncio.gather(coro2(), coro2()) + + async def coro2(): + stack = asyncio.get_async_stack() + self.check_stack(stack, [coro, coro2]) + + self.loop.run_until_complete(coro()) + + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py index d848bfbd46c..cd1679f709d 100644 --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -2474,5 +2474,63 @@ async def foo(): self.assertEqual(foo().send(None), 1) + +class CoroutineAwaiterTest(unittest.TestCase): + def test_basic_await(self): + async def coro(): + self.assertIs(coro_obj.cr_awaiter, awaiter_obj) + return "success" + + async def awaiter(): + return await coro_obj + + coro_obj = coro() + awaiter_obj = awaiter() + self.assertIsNone(coro_obj.cr_awaiter) + self.assertEqual(run_async(awaiter_obj), ([], "success")) + + class FakeFuture: + def __await__(self): + return iter(["future"]) + + def test_coro_outlives_awaiter(self): + async def coro(): + await self.FakeFuture() + + async def awaiter(cr): + await cr + + coro_obj = coro() + self.assertIsNone(coro_obj.cr_awaiter) + awaiter_obj = awaiter(coro_obj) + self.assertIsNone(coro_obj.cr_awaiter) + + v1 = awaiter_obj.send(None) + self.assertEqual(v1, "future") + self.assertIs(coro_obj.cr_awaiter, awaiter_obj) + + awaiter_id = id(awaiter_obj) + del awaiter_obj + self.assertEqual(id(coro_obj.cr_awaiter), awaiter_id) + + def test_async_gen_awaiter(self): + async def coro(): + self.assertIs(coro_obj.cr_awaiter, agen) + await self.FakeFuture() + + async def async_gen(cr): + await cr + yield "hi" + + coro_obj = coro() + self.assertIsNone(coro_obj.cr_awaiter) + agen = async_gen(coro_obj) + self.assertIsNone(coro_obj.cr_awaiter) + + v1 = agen.asend(None).send(None) + self.assertEqual(v1, "future") + + + if __name__=="__main__": unittest.main() diff --git a/Misc/ACKS b/Misc/ACKS index 88bac0a8749..4bb3349a7f2 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1356,6 +1356,7 @@ Noah Oxer Joonas Paalasmaa Yaroslav Pankovych Martin Packman +Matt Page Elisha Paine Shriphani Palakodety Julien Palard diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 2bafa04d4df..3870cbc4423 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -24,9 +24,12 @@ typedef struct futureiterobject futureiterobject; /* State of the _asyncio module */ typedef struct { PyTypeObject *FutureIterType; + Ci_AsyncMethodsWithExtra FutureIterType_ame; PyTypeObject *TaskStepMethWrapper_Type; PyTypeObject *FutureType; + Ci_AsyncMethodsWithExtra FutureType_ame; PyTypeObject *TaskType; + Ci_AsyncMethodsWithExtra TaskType_ame; PyObject *asyncio_mod; PyObject *context_kwname; @@ -1408,6 +1411,28 @@ FutureObj_repr(FutureObj *fut) return PyObject_CallOneArg(state->asyncio_future_repr_func, (PyObject *)fut); } +static void +Ci_FutureObj_set_awaiter(PyObject *self, PyObject *awaiter) +{ + PyObject *set_awaiter_func = PyObject_GetAttrString(self, "__set_awaiter__"); + if (set_awaiter_func == NULL) { + PyErr_Clear(); + return; + } + PyObject *args[] = {awaiter}; + PyObject *res = PyObject_Vectorcall(set_awaiter_func, args, 1, NULL); + if (res == NULL) { + PyErr_WarnFormat( + PyExc_RuntimeWarning, + 1, + "__set_awaiter__ on %R failed for awaiter %R", + self, + awaiter); + return; + } + Py_DECREF(res); +} + /*[clinic input] _asyncio.Future._make_cancelled_error @@ -1551,7 +1576,7 @@ static PyType_Spec Future_spec = { .name = "_asyncio.Future", .basicsize = sizeof(FutureObj), .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_IMMUTABLETYPE), + Py_TPFLAGS_IMMUTABLETYPE | Ci_TPFLAGS_HAVE_AM_EXTRA), .slots = Future_slots, }; @@ -1657,6 +1682,22 @@ FutureIter_am_send(futureiterobject *it, return PYGEN_ERROR; } +static void +Ci_FutureIter_set_awaiter(PyObject *it, PyObject *awaiter) +{ + FutureObj* future = ((futureiterobject *)it)->future; + if (future != NULL) { + Ci_PyAwaitable_SetAwaiter((PyObject *)future, awaiter); + } +} + +static PyObject* +Ci_PyCWrapper_FutureIter_set_awaiter(PyObject *self, PyObject *awaiter) +{ + Ci_FutureIter_set_awaiter(self, awaiter); + Py_RETURN_NONE; +} + static PyObject * FutureIter_iternext(futureiterobject *it) { @@ -1784,6 +1825,7 @@ static PyMethodDef FutureIter_methods[] = { {"send", (PyCFunction)FutureIter_send, METH_O, NULL}, {"throw", _PyCFunction_CAST(FutureIter_throw), METH_FASTCALL, NULL}, {"close", (PyCFunction)FutureIter_close, METH_NOARGS, NULL}, + {"__set_awaiter__", Ci_PyCWrapper_FutureIter_set_awaiter, METH_O, NULL}, {NULL, NULL} /* Sentinel */ }; @@ -1805,7 +1847,7 @@ static PyType_Spec FutureIter_spec = { .name = "_asyncio.FutureIter", .basicsize = sizeof(futureiterobject), .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_IMMUTABLETYPE), + Py_TPFLAGS_IMMUTABLETYPE | Ci_TPFLAGS_HAVE_AM_EXTRA), .slots = FutureIter_slots, }; @@ -2665,6 +2707,23 @@ TaskObj_finalize(TaskObj *task) static void TaskObj_dealloc(PyObject *); /* Needs Task_CheckExact */ +static void +Ci_TaskObj_set_awaiter(PyObject *self, PyObject *awaiter) +{ + TaskObj *task = (TaskObj*)self; + if (task->task_coro == NULL) { + return; + } + Ci_PyAwaitable_SetAwaiter(task->task_coro, awaiter); +} + +static PyObject* +Ci_PyCWrapper_TaskObj_set_awaiter(PyObject *self, PyObject *awaiter) +{ + Ci_TaskObj_set_awaiter(self, awaiter); + Py_RETURN_NONE; +} + static PyMethodDef TaskType_methods[] = { _ASYNCIO_FUTURE_RESULT_METHODDEF _ASYNCIO_FUTURE_EXCEPTION_METHODDEF @@ -2688,6 +2747,7 @@ static PyMethodDef TaskType_methods[] = { _ASYNCIO_TASK__STEP_METHODDEF // END META PATCH {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")}, + {"__set_awaiter__", Ci_PyCWrapper_TaskObj_set_awaiter, METH_O, NULL}, {NULL, NULL} /* Sentinel */ }; @@ -2730,7 +2790,7 @@ static PyType_Spec Task_spec = { .name = "_asyncio.Task", .basicsize = sizeof(TaskObj), .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_IMMUTABLETYPE), + Py_TPFLAGS_IMMUTABLETYPE | Ci_TPFLAGS_HAVE_AM_EXTRA), .slots = Task_slots, }; @@ -3813,11 +3873,23 @@ module_exec(PyObject *mod) } \ } while (0) +#define ADD_SET_AWAITER(type_name, func) \ + do { \ + memcpy(&state->type_name ## _ame.ame_async_methods, state->type_name->tp_as_async, sizeof(PyAsyncMethods)); \ + state->type_name->tp_as_async = &state->type_name ## _ame; \ + state->type_name ## _ame.ame_setawaiter = func; \ + Ci_HeapType_AM_EXTRA(state->FutureIterType)->ame_setawaiter = func; \ + } while (0) + CREATE_TYPE(mod, state->TaskStepMethWrapper_Type, &TaskStepMethWrapper_spec, NULL); CREATE_TYPE(mod, state->FutureIterType, &FutureIter_spec, NULL); + ADD_SET_AWAITER(FutureIterType, Ci_FutureIter_set_awaiter); CREATE_TYPE(mod, state->FutureType, &Future_spec, NULL); + ADD_SET_AWAITER(FutureType, Ci_FutureObj_set_awaiter); CREATE_TYPE(mod, state->TaskType, &Task_spec, state->FutureType); + ADD_SET_AWAITER(TaskType, Ci_TaskObj_set_awaiter); +#undef ADD_SET_AWAITER #undef CREATE_TYPE if (PyModule_AddType(mod, state->FutureType) < 0) { diff --git a/Objects/genobject.c b/Objects/genobject.c index 9908da9002b..a05aa8b82eb 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -61,6 +61,7 @@ gen_traverse(PyGenObject *gen, visitproc visit, void *arg) return err; } } + Py_VISIT(gen->gi_ci_awaiter); /* No need to visit cr_origin, because it's just tuples/str/int, so can't participate in a reference cycle. */ return exc_state_traverse(&gen->gi_exc_state, visit, arg); @@ -76,6 +77,16 @@ _PyGen_Finalize(PyObject *self) return; } + if (PyCoro_CheckExact(self)) { + /* If we're suspended in an `await`, remove us as the awaiter of the + * target awaitable. */ + PyObject *yf = _PyGen_yf(gen); + if (yf) { + Ci_PyAwaitable_SetAwaiter(yf, NULL); + Py_DECREF(yf); + } + } + if (PyAsyncGen_CheckExact(self)) { PyAsyncGenObject *agen = (PyAsyncGenObject*)self; PyObject *finalizer = agen->ag_origin_or_finalizer; @@ -157,6 +168,7 @@ gen_dealloc(PyGenObject *gen) Py_CLEAR(gen->gi_name); Py_CLEAR(gen->gi_qualname); _PyErr_ClearExcState(&gen->gi_exc_state); + Py_CLEAR(gen->gi_ci_awaiter); PyObject_GC_Del(gen); } @@ -252,6 +264,10 @@ gen_send_ex2(PyGenObject *gen, PyObject *arg, PyObject **presult, !PyErr_ExceptionMatches(PyExc_StopAsyncIteration)); } + /* Avoid holding on to the reference to the awaiter any longer than + necessary */ + Py_CLEAR(gen->gi_ci_awaiter); + /* generator can't be rerun, so release the frame */ /* first clean reference cycle through stored exception traceback */ _PyErr_ClearExcState(&gen->gi_exc_state); @@ -897,6 +913,7 @@ make_gen(PyTypeObject *type, PyFunctionObject *func) gen->gi_name = Py_NewRef(func->func_name); assert(func->func_qualname != NULL); gen->gi_qualname = Py_NewRef(func->func_qualname); + gen->gi_ci_awaiter = NULL; _PyObject_GC_TRACK(gen); return (PyObject *)gen; } @@ -1096,6 +1113,36 @@ coro_get_cr_await(PyCoroObject *coro, void *Py_UNUSED(ignored)) return yf; } +/* Awaiters are only set on coroutines or async generators */ +static PyObject * +Ci_get_awaiter(PyGenObject *gen, void *Py_UNUSED(ignored)) +{ + PyObject *awaiter = gen->gi_ci_awaiter; + if (awaiter == NULL) { + Py_RETURN_NONE; + } + Py_INCREF(awaiter); + return awaiter; +} + +static void +Ci_set_awaiter(PyGenObject *gen, PyObject *awaiter) +{ + if (awaiter == NULL) { + Py_CLEAR(gen->gi_ci_awaiter); + } else if (gen->gi_frame_state < FRAME_COMPLETED) { + Py_XINCREF(awaiter); + Py_XSETREF(gen->gi_ci_awaiter, awaiter); + } +} + +static PyObject * +Ci_PyCWrapper_set_awaiter(PyObject *gen, PyObject *awaiter) +{ + Ci_set_awaiter((PyGenObject *)gen, awaiter); + Py_RETURN_NONE; +} + static PyObject * cr_getsuspended(PyCoroObject *coro, void *Py_UNUSED(ignored)) { @@ -1138,6 +1185,8 @@ static PyGetSetDef coro_getsetlist[] = { {"cr_frame", (getter)cr_getframe, NULL, NULL}, {"cr_code", (getter)cr_getcode, NULL, NULL}, {"cr_suspended", (getter)cr_getsuspended, NULL, NULL}, + {"cr_ci_awaiter", (getter)Ci_get_awaiter, NULL, NULL}, + {"cr_awaiter", (getter)Ci_get_awaiter, NULL, NULL}, {NULL} /* Sentinel */ }; @@ -1168,14 +1217,18 @@ static PyMethodDef coro_methods[] = { {"throw",_PyCFunction_CAST(gen_throw), METH_FASTCALL, coro_throw_doc}, {"close",(PyCFunction)gen_close, METH_NOARGS, coro_close_doc}, {"__sizeof__", (PyCFunction)gen_sizeof, METH_NOARGS, sizeof__doc__}, + {"__set_awaiter__", (PyCFunction)Ci_PyCWrapper_set_awaiter, METH_O, NULL}, {NULL, NULL} /* Sentinel */ }; -static PyAsyncMethods coro_as_async = { - (unaryfunc)coro_await, /* am_await */ - 0, /* am_aiter */ - 0, /* am_anext */ - (sendfunc)PyGen_am_send, /* am_send */ +static Ci_AsyncMethodsWithExtra coro_as_async = { + .ame_async_methods = { + (unaryfunc)coro_await, /* am_await */ + 0, /* am_aiter */ + 0, /* am_anext */ + (sendfunc)PyGen_am_send, /* am_send */ + }, + .ame_setawaiter = (setawaiterfunc)Ci_set_awaiter, }; PyTypeObject PyCoro_Type = { @@ -1200,7 +1253,8 @@ PyTypeObject PyCoro_Type = { PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | + Ci_TPFLAGS_HAVE_AM_EXTRA, /* tp_flags */ 0, /* tp_doc */ (traverseproc)gen_traverse, /* tp_traverse */ 0, /* tp_clear */ @@ -1552,6 +1606,7 @@ static PyGetSetDef async_gen_getsetlist[] = { {"ag_frame", (getter)ag_getframe, NULL, NULL}, {"ag_code", (getter)ag_getcode, NULL, NULL}, {"ag_suspended", (getter)ag_getsuspended, NULL, NULL}, + {"ag_awaiter", (getter)Ci_get_awaiter, NULL, NULL}, {NULL} /* Sentinel */ }; @@ -1582,18 +1637,20 @@ static PyMethodDef async_gen_methods[] = { {"__sizeof__", (PyCFunction)gen_sizeof, METH_NOARGS, sizeof__doc__}, {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")}, + {"__set_awaiter__", (PyCFunction)Ci_PyCWrapper_set_awaiter, METH_O, NULL}, {NULL, NULL} /* Sentinel */ }; - -static PyAsyncMethods async_gen_as_async = { - 0, /* am_await */ - PyObject_SelfIter, /* am_aiter */ - (unaryfunc)async_gen_anext, /* am_anext */ - (sendfunc)PyGen_am_send, /* am_send */ +static Ci_AsyncMethodsWithExtra async_gen_as_async = { + .ame_async_methods = { + 0, /* am_await */ + PyObject_SelfIter, /* am_aiter */ + (unaryfunc)async_gen_anext, /* am_anext */ + (sendfunc)PyGen_am_send, /* am_send */ + }, + .ame_setawaiter = (setawaiterfunc)Ci_set_awaiter, }; - PyTypeObject PyAsyncGen_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "async_generator", /* tp_name */ @@ -1616,7 +1673,8 @@ PyTypeObject PyAsyncGen_Type = { PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | + Ci_TPFLAGS_HAVE_AM_EXTRA, /* tp_flags */ 0, /* tp_doc */ (traverseproc)async_gen_traverse, /* tp_traverse */ 0, /* tp_clear */ @@ -1872,12 +1930,20 @@ static PyMethodDef async_gen_asend_methods[] = { {NULL, NULL} /* Sentinel */ }; +static void +Ci_async_gen_asend_set_awaiter(PyAsyncGenASend *o, PyObject *awaiter) +{ + Ci_set_awaiter((PyGenObject *) o->ags_gen, awaiter); +} -static PyAsyncMethods async_gen_asend_as_async = { - PyObject_SelfIter, /* am_await */ - 0, /* am_aiter */ - 0, /* am_anext */ - 0, /* am_send */ +static Ci_AsyncMethodsWithExtra async_gen_asend_as_async = { + .ame_async_methods = { + PyObject_SelfIter, /* am_await */ + 0, /* am_aiter */ + 0, /* am_anext */ + 0, /* am_send */ + }, + .ame_setawaiter = (setawaiterfunc)Ci_async_gen_asend_set_awaiter, }; @@ -1902,7 +1968,8 @@ PyTypeObject _PyAsyncGenASend_Type = { PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | + Ci_TPFLAGS_HAVE_AM_EXTRA, /* tp_flags */ 0, /* tp_doc */ (traverseproc)async_gen_asend_traverse, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 3a7bafeb416..c5c91c06301 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -836,6 +836,10 @@ dummy_func( DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ assert(frame != &entry_frame); + if ((frame->owner == FRAME_OWNED_BY_GENERATOR) && + (frame->f_code->co_flags & (CO_COROUTINE | CO_ASYNC_GENERATOR))) { + Ci_PyAwaitable_SetAwaiter(receiver, (PyObject *) _PyFrame_GetGenerator(frame)); + } if ((tstate->interp->eval_frame == NULL) && (Py_TYPE(receiver) == &PyGen_Type || Py_TYPE(receiver) == &PyCoro_Type) && ((PyGenObject *)receiver)->gi_frame_state < FRAME_EXECUTING) @@ -880,6 +884,10 @@ dummy_func( Py_TYPE(gen) != &PyCoro_Type, SEND); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, SEND); STAT_INC(SEND, hit); + if ((frame->owner == FRAME_OWNED_BY_GENERATOR) && + (frame->f_code->co_flags & (CO_COROUTINE | CO_ASYNC_GENERATOR))) { + Ci_PyAwaitable_SetAwaiter(receiver, (PyObject *)gen); + } _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; frame->return_offset = oparg; STACK_SHRINK(1); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 952fc553229..70a20a0f400 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -8,6 +8,7 @@ } TARGET(RESUME) { + #line 139 "Python/bytecodes.c" assert(tstate->cframe == &cframe); assert(frame == cframe.current_frame); /* Possibly combine this with eval breaker */ @@ -19,10 +20,12 @@ else if (_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker) && oparg < 2) { goto handle_eval_breaker; } + #line 24 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_RESUME) { + #line 153 "Python/bytecodes.c" /* Possible performance enhancement: * We need to check the eval breaker anyway, can we * combine the instrument verison check and the eval breaker test? @@ -48,15 +51,18 @@ goto handle_eval_breaker; } } + #line 55 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_CLOSURE) { PyObject *value; + #line 181 "Python/bytecodes.c" /* We keep LOAD_CLOSURE so that the bytecode stays more readable. */ value = GETLOCAL(oparg); if (value == NULL) goto unbound_local_error; Py_INCREF(value); + #line 66 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -64,9 +70,11 @@ TARGET(LOAD_FAST_CHECK) { PyObject *value; + #line 188 "Python/bytecodes.c" value = GETLOCAL(oparg); if (value == NULL) goto unbound_local_error; Py_INCREF(value); + #line 78 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -74,9 +82,11 @@ TARGET(LOAD_FAST) { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 90 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -84,9 +94,11 @@ TARGET(LOAD_FAST_AND_CLEAR) { PyObject *value; + #line 200 "Python/bytecodes.c" value = GETLOCAL(oparg); // do not use SETLOCAL here, it decrefs the old value GETLOCAL(oparg) = NULL; + #line 102 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -95,8 +107,10 @@ TARGET(LOAD_CONST) { PREDICTED(LOAD_CONST); PyObject *value; + #line 206 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); + #line 114 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -104,7 +118,9 @@ TARGET(STORE_FAST) { PyObject *value = stack_pointer[-1]; + #line 211 "Python/bytecodes.c" SETLOCAL(oparg, value); + #line 124 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -114,17 +130,21 @@ PyObject *_tmp_2; { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 138 "Python/generated_cases.c.h" _tmp_2 = value; } oparg = (next_instr++)->op.arg; { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 148 "Python/generated_cases.c.h" _tmp_1 = value; } STACK_GROW(2); @@ -138,16 +158,20 @@ PyObject *_tmp_2; { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 166 "Python/generated_cases.c.h" _tmp_2 = value; } oparg = (next_instr++)->op.arg; { PyObject *value; + #line 206 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); + #line 175 "Python/generated_cases.c.h" _tmp_1 = value; } STACK_GROW(2); @@ -160,14 +184,18 @@ PyObject *_tmp_1 = stack_pointer[-1]; { PyObject *value = _tmp_1; + #line 211 "Python/bytecodes.c" SETLOCAL(oparg, value); + #line 190 "Python/generated_cases.c.h" } oparg = (next_instr++)->op.arg; { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 199 "Python/generated_cases.c.h" _tmp_1 = value; } stack_pointer[-1] = _tmp_1; @@ -179,12 +207,16 @@ PyObject *_tmp_2 = stack_pointer[-2]; { PyObject *value = _tmp_1; + #line 211 "Python/bytecodes.c" SETLOCAL(oparg, value); + #line 213 "Python/generated_cases.c.h" } oparg = (next_instr++)->op.arg; { PyObject *value = _tmp_2; + #line 211 "Python/bytecodes.c" SETLOCAL(oparg, value); + #line 220 "Python/generated_cases.c.h" } STACK_SHRINK(2); DISPATCH(); @@ -195,16 +227,20 @@ PyObject *_tmp_2; { PyObject *value; + #line 206 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); + #line 234 "Python/generated_cases.c.h" _tmp_2 = value; } oparg = (next_instr++)->op.arg; { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 244 "Python/generated_cases.c.h" _tmp_1 = value; } STACK_GROW(2); @@ -215,6 +251,8 @@ TARGET(POP_TOP) { PyObject *value = stack_pointer[-1]; + #line 221 "Python/bytecodes.c" + #line 256 "Python/generated_cases.c.h" Py_DECREF(value); STACK_SHRINK(1); DISPATCH(); @@ -222,7 +260,9 @@ TARGET(PUSH_NULL) { PyObject *res; + #line 225 "Python/bytecodes.c" res = NULL; + #line 266 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -233,10 +273,14 @@ PyObject *_tmp_2 = stack_pointer[-2]; { PyObject *value = _tmp_1; + #line 221 "Python/bytecodes.c" + #line 278 "Python/generated_cases.c.h" Py_DECREF(value); } { PyObject *value = _tmp_2; + #line 221 "Python/bytecodes.c" + #line 284 "Python/generated_cases.c.h" Py_DECREF(value); } STACK_SHRINK(2); @@ -246,6 +290,7 @@ TARGET(INSTRUMENTED_END_FOR) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; + #line 231 "Python/bytecodes.c" /* Need to create a fake StopIteration error here, * to conform to PEP 380 */ if (PyGen_Check(receiver)) { @@ -255,6 +300,7 @@ } PyErr_SetRaisedException(NULL); } + #line 304 "Python/generated_cases.c.h" Py_DECREF(receiver); Py_DECREF(value); STACK_SHRINK(2); @@ -264,7 +310,9 @@ TARGET(END_SEND) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; + #line 244 "Python/bytecodes.c" Py_DECREF(receiver); + #line 316 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; DISPATCH(); @@ -273,6 +321,7 @@ TARGET(INSTRUMENTED_END_SEND) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; + #line 248 "Python/bytecodes.c" if (PyGen_Check(receiver) || PyCoro_CheckExact(receiver)) { PyErr_SetObject(PyExc_StopIteration, value); if (monitor_stop_iteration(tstate, frame, next_instr-1)) { @@ -281,6 +330,7 @@ PyErr_SetRaisedException(NULL); } Py_DECREF(receiver); + #line 334 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; DISPATCH(); @@ -289,9 +339,13 @@ TARGET(UNARY_NEGATIVE) { PyObject *value = stack_pointer[-1]; PyObject *res; + #line 259 "Python/bytecodes.c" res = PyNumber_Negative(value); + #line 345 "Python/generated_cases.c.h" Py_DECREF(value); + #line 261 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; + #line 349 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -299,8 +353,11 @@ TARGET(UNARY_NOT) { PyObject *value = stack_pointer[-1]; PyObject *res; + #line 265 "Python/bytecodes.c" int err = PyObject_IsTrue(value); + #line 359 "Python/generated_cases.c.h" Py_DECREF(value); + #line 267 "Python/bytecodes.c" if (err < 0) goto pop_1_error; if (err == 0) { res = Py_True; @@ -308,6 +365,7 @@ else { res = Py_False; } + #line 369 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -315,9 +373,13 @@ TARGET(UNARY_INVERT) { PyObject *value = stack_pointer[-1]; PyObject *res; + #line 277 "Python/bytecodes.c" res = PyNumber_Invert(value); + #line 379 "Python/generated_cases.c.h" Py_DECREF(value); + #line 279 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; + #line 383 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -326,6 +388,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *prod; + #line 296 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -333,6 +396,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (prod == NULL) goto pop_2_error; + #line 400 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = prod; next_instr += 1; @@ -343,12 +407,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *prod; + #line 306 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); double dprod = ((PyFloatObject *)left)->ob_fval * ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dprod, prod); + #line 418 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = prod; next_instr += 1; @@ -359,6 +425,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sub; + #line 315 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -366,6 +433,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (sub == NULL) goto pop_2_error; + #line 437 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = sub; next_instr += 1; @@ -376,11 +444,13 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sub; + #line 325 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); double dsub = ((PyFloatObject *)left)->ob_fval - ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dsub, sub); + #line 454 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = sub; next_instr += 1; @@ -391,6 +461,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; + #line 333 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -398,6 +469,7 @@ _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc); if (res == NULL) goto pop_2_error; + #line 473 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -407,6 +479,7 @@ TARGET(BINARY_OP_INPLACE_ADD_UNICODE) { PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; + #line 349 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); _Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP]; @@ -433,6 +506,7 @@ if (*target_local == NULL) goto pop_2_error; // The STORE_FAST is already done. JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP + 1); + #line 510 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -441,12 +515,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sum; + #line 378 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); STAT_INC(BINARY_OP, hit); double dsum = ((PyFloatObject *)left)->ob_fval + ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dsum, sum); + #line 526 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = sum; next_instr += 1; @@ -457,6 +533,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sum; + #line 387 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -464,6 +541,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (sum == NULL) goto pop_2_error; + #line 545 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = sum; next_instr += 1; @@ -476,6 +554,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; PyObject *res; + #line 405 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -487,9 +566,12 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ res = PyObject_GetItem(container, sub); + #line 570 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); + #line 417 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 575 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -501,6 +583,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *res; + #line 421 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); // Can't use ERROR_IF() here, because we haven't // DECREF'ed container yet, and we still own slice. @@ -513,6 +596,7 @@ } Py_DECREF(container); if (res == NULL) goto pop_3_error; + #line 600 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = res; DISPATCH(); @@ -523,6 +607,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *v = stack_pointer[-4]; + #line 436 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); int err; if (slice == NULL) { @@ -535,6 +620,7 @@ Py_DECREF(v); Py_DECREF(container); if (err) goto pop_4_error; + #line 624 "Python/generated_cases.c.h" STACK_SHRINK(4); DISPATCH(); } @@ -543,6 +629,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *res; + #line 451 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), BINARY_SUBSCR); @@ -556,6 +643,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); + #line 647 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -566,6 +654,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *tuple = stack_pointer[-2]; PyObject *res; + #line 467 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyTuple_CheckExact(tuple), BINARY_SUBSCR); @@ -579,6 +668,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(tuple); + #line 672 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -589,6 +679,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *res; + #line 483 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR); STAT_INC(BINARY_SUBSCR, hit); res = PyDict_GetItemWithError(dict, sub); @@ -596,11 +687,14 @@ if (!_PyErr_Occurred(tstate)) { _PyErr_SetKeyError(sub); } + #line 691 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); + #line 491 "Python/bytecodes.c" if (true) goto pop_2_error; } Py_INCREF(res); // Do this before DECREF'ing dict, sub + #line 698 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); STACK_SHRINK(1); @@ -612,6 +706,7 @@ TARGET(BINARY_SUBSCR_GETITEM) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; + #line 498 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, BINARY_SUBSCR); PyTypeObject *tp = Py_TYPE(container); DEOPT_IF(!PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE), BINARY_SUBSCR); @@ -634,12 +729,15 @@ JUMPBY(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); + #line 733 "Python/generated_cases.c.h" } TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; + #line 523 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; + #line 741 "Python/generated_cases.c.h" STACK_SHRINK(1); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -648,9 +746,13 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; + #line 528 "Python/bytecodes.c" int err = PySet_Add(set, v); + #line 752 "Python/generated_cases.c.h" Py_DECREF(v); + #line 530 "Python/bytecodes.c" if (err) goto pop_1_error; + #line 756 "Python/generated_cases.c.h" STACK_SHRINK(1); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -663,6 +765,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); + #line 541 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -677,10 +780,13 @@ #endif /* ENABLE_SPECIALIZATION */ /* container[sub] = v */ int err = PyObject_SetItem(container, sub, v); + #line 784 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); + #line 556 "Python/bytecodes.c" if (err) goto pop_3_error; + #line 790 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -690,6 +796,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; + #line 560 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -706,6 +813,7 @@ Py_DECREF(old_value); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); + #line 817 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -715,11 +823,13 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; + #line 579 "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 833 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -728,11 +838,15 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; + #line 587 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); + #line 845 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); + #line 590 "Python/bytecodes.c" if (err) goto pop_2_error; + #line 850 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -740,10 +854,14 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; + #line 594 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); + #line 861 "Python/generated_cases.c.h" Py_DECREF(value); + #line 597 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; + #line 865 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -752,11 +870,15 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; + #line 601 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); + #line 877 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); + #line 604 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 882 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -764,6 +886,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); + #line 608 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -785,10 +908,12 @@ break; } if (true) { STACK_SHRINK(oparg); goto error; } + #line 912 "Python/generated_cases.c.h" } TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; + #line 632 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); STACK_SHRINK(1); // Since we're not going to DISPATCH() @@ -799,10 +924,12 @@ assert(!_PyErr_Occurred(tstate)); tstate->c_recursion_remaining += PY_EVAL_C_STACK_UNITS; return retval; + #line 928 "Python/generated_cases.c.h" } TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; + #line 645 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -815,10 +942,12 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 946 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; + #line 660 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -835,9 +964,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 968 "Python/generated_cases.c.h" } TARGET(RETURN_CONST) { + #line 679 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -851,9 +982,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 986 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_CONST) { + #line 695 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -871,11 +1004,13 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 1008 "Python/generated_cases.c.h" } TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; + #line 715 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -888,12 +1023,16 @@ "'async for' requires an object with " "__aiter__ method, got %.100s", type->tp_name); + #line 1027 "Python/generated_cases.c.h" Py_DECREF(obj); + #line 728 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); + #line 1034 "Python/generated_cases.c.h" Py_DECREF(obj); + #line 733 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -906,6 +1045,7 @@ Py_DECREF(iter); if (true) goto pop_1_error; } + #line 1049 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -913,6 +1053,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; + #line 748 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -956,6 +1097,7 @@ } } + #line 1101 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = awaitable; PREDICT(LOAD_CONST); @@ -966,13 +1108,16 @@ PREDICTED(GET_AWAITABLE); PyObject *iterable = stack_pointer[-1]; PyObject *iter; + #line 795 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { format_awaitable_error(tstate, Py_TYPE(iterable), oparg); } + #line 1119 "Python/generated_cases.c.h" Py_DECREF(iterable); + #line 802 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -990,6 +1135,7 @@ if (iter == NULL) goto pop_1_error; + #line 1139 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -1001,6 +1147,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; + #line 828 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1012,6 +1159,10 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ assert(frame != &entry_frame); + if ((frame->owner == FRAME_OWNED_BY_GENERATOR) && + (frame->f_code->co_flags & (CO_COROUTINE | CO_ASYNC_GENERATOR))) { + Ci_PyAwaitable_SetAwaiter(receiver, (PyObject *) _PyFrame_GetGenerator(frame)); + } if ((tstate->interp->eval_frame == NULL) && (Py_TYPE(receiver) == &PyGen_Type || Py_TYPE(receiver) == &PyCoro_Type) && ((PyGenObject *)receiver)->gi_frame_state < FRAME_EXECUTING) @@ -1047,6 +1198,7 @@ } } Py_DECREF(v); + #line 1202 "Python/generated_cases.c.h" stack_pointer[-1] = retval; next_instr += 1; DISPATCH(); @@ -1055,12 +1207,17 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; + #line 881 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, SEND); 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); + if ((frame->owner == FRAME_OWNED_BY_GENERATOR) && + (frame->f_code->co_flags & (CO_COROUTINE | CO_ASYNC_GENERATOR))) { + Ci_PyAwaitable_SetAwaiter(receiver, (PyObject *)gen); + } _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; frame->return_offset = oparg; STACK_SHRINK(1); @@ -1070,10 +1227,12 @@ tstate->exc_info = &gen->gi_exc_state; JUMPBY(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); + #line 1231 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; + #line 903 "Python/bytecodes.c" assert(frame != &entry_frame); PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; @@ -1090,10 +1249,12 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 1253 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; + #line 922 "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. @@ -1109,12 +1270,15 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 1274 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; + #line 940 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); + #line 1282 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1122,6 +1286,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); + #line 945 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1140,15 +1305,19 @@ _PyErr_SetRaisedException(tstate, exc); monitor_reraise(tstate, frame, next_instr-1); goto exception_unwind; + #line 1309 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; + #line 966 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { + #line 1318 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); + #line 969 "Python/bytecodes.c" } else { Py_INCREF(exc); @@ -1156,6 +1325,7 @@ monitor_reraise(tstate, frame, next_instr-1); goto exception_unwind; } + #line 1329 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1166,13 +1336,16 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; + #line 979 "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 1345 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); + #line 984 "Python/bytecodes.c" none = Py_None; } else { @@ -1180,6 +1353,7 @@ monitor_reraise(tstate, frame, next_instr-1); goto exception_unwind; } + #line 1357 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1188,7 +1362,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; + #line 994 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); + #line 1368 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1196,6 +1372,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; + #line 998 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1217,6 +1394,7 @@ if (true) goto error; } } + #line 1398 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1224,26 +1402,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; + #line 1023 "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 1413 "Python/generated_cases.c.h" Py_DECREF(v); + #line 1030 "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 1422 "Python/generated_cases.c.h" Py_DECREF(v); + #line 1037 "Python/bytecodes.c" if (err) goto pop_1_error; + #line 1426 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { + #line 1041 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1260,6 +1445,7 @@ name); goto error; } + #line 1449 "Python/generated_cases.c.h" DISPATCH(); } @@ -1267,6 +1453,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; + #line 1067 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1279,8 +1466,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); + #line 1470 "Python/generated_cases.c.h" Py_DECREF(seq); + #line 1080 "Python/bytecodes.c" if (res == 0) goto pop_1_error; + #line 1474 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1290,12 +1480,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); + #line 1084 "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 1491 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1306,6 +1498,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); + #line 1094 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1313,6 +1506,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } + #line 1510 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1323,6 +1517,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); + #line 1105 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1330,6 +1525,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } + #line 1529 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1339,11 +1535,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; + #line 1116 "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 1543 "Python/generated_cases.c.h" Py_DECREF(seq); + #line 1120 "Python/bytecodes.c" if (res == 0) goto pop_1_error; + #line 1547 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1354,6 +1554,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); + #line 1131 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg); @@ -1369,9 +1570,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, v); + #line 1574 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); + #line 1147 "Python/bytecodes.c" if (err) goto pop_2_error; + #line 1579 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1379,25 +1583,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; + #line 1151 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); + #line 1590 "Python/generated_cases.c.h" Py_DECREF(owner); + #line 1154 "Python/bytecodes.c" if (err) goto pop_1_error; + #line 1594 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; + #line 1158 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); + #line 1604 "Python/generated_cases.c.h" Py_DECREF(v); + #line 1161 "Python/bytecodes.c" if (err) goto pop_1_error; + #line 1608 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { + #line 1165 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1409,11 +1622,13 @@ } goto error; } + #line 1626 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_LOCALS) { PyObject *locals; + #line 1179 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1421,6 +1636,7 @@ if (true) goto error; } Py_INCREF(locals); + #line 1640 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = locals; DISPATCH(); @@ -1429,6 +1645,7 @@ TARGET(LOAD_FROM_DICT_OR_GLOBALS) { PyObject *mod_or_class_dict = stack_pointer[-1]; PyObject *v; + #line 1189 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1490,6 +1707,7 @@ } } } + #line 1711 "Python/generated_cases.c.h" Py_DECREF(mod_or_class_dict); stack_pointer[-1] = v; DISPATCH(); @@ -1497,6 +1715,7 @@ TARGET(LOAD_NAME) { PyObject *v; + #line 1254 "Python/bytecodes.c" PyObject *mod_or_class_dict = LOCALS(); if (mod_or_class_dict == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1556,6 +1775,7 @@ } } } + #line 1779 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = v; DISPATCH(); @@ -1566,6 +1786,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; + #line 1322 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1617,6 +1838,7 @@ } } null = NULL; + #line 1842 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -1630,6 +1852,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); + #line 1376 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -1653,6 +1876,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; + #line 1880 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1667,6 +1891,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 1402 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -1695,6 +1920,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; + #line 1924 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1704,13 +1930,16 @@ } TARGET(DELETE_FAST) { + #line 1433 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); + #line 1938 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { + #line 1439 "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); @@ -1719,10 +1948,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); + #line 1952 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { + #line 1450 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -1733,12 +1964,14 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); + #line 1968 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; + #line 1463 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -1771,12 +2004,14 @@ Py_INCREF(value); } Py_DECREF(class_dict); + #line 2008 "Python/generated_cases.c.h" stack_pointer[-1] = value; DISPATCH(); } TARGET(LOAD_DEREF) { PyObject *value; + #line 1498 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -1784,6 +2019,7 @@ if (true) goto error; } Py_INCREF(value); + #line 2023 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1791,15 +2027,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; + #line 1508 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); + #line 2036 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { + #line 1515 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -1810,17 +2049,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } + #line 2053 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; + #line 1528 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); + #line 2062 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } + #line 1530 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } + #line 2068 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -1830,8 +2074,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; + #line 1534 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } + #line 2081 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -1841,8 +2087,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; + #line 1539 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } + #line 2094 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -1852,6 +2100,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; + #line 1544 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -1862,10 +2111,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } + #line 2115 "Python/generated_cases.c.h" Py_DECREF(iterable); + #line 1555 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); + #line 2121 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -1874,9 +2126,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; + #line 1562 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); + #line 2132 "Python/generated_cases.c.h" Py_DECREF(iterable); + #line 1564 "Python/bytecodes.c" if (err < 0) goto pop_1_error; + #line 2136 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1884,6 +2140,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; + #line 1568 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -1898,6 +2155,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } + #line 2159 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -1907,14 +2165,18 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; + #line 1585 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, oparg); + #line 2174 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } + #line 1590 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } + #line 2180 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -1922,6 +2184,7 @@ } TARGET(SETUP_ANNOTATIONS) { + #line 1594 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -1961,6 +2224,7 @@ Py_DECREF(ann_dict); } } + #line 2228 "Python/generated_cases.c.h" DISPATCH(); } @@ -1968,6 +2232,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; + #line 1636 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1977,11 +2242,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); + #line 2246 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); + #line 1646 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } + #line 2253 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -1989,6 +2257,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; + #line 1650 "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)) { @@ -1996,9 +2265,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } + #line 2269 "Python/generated_cases.c.h" Py_DECREF(update); + #line 1658 "Python/bytecodes.c" if (true) goto pop_1_error; } + #line 2274 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2006,13 +2278,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; + #line 1664 "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 2287 "Python/generated_cases.c.h" Py_DECREF(update); + #line 1669 "Python/bytecodes.c" if (true) goto pop_1_error; } + #line 2292 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); PREDICT(CALL_FUNCTION_EX); @@ -2022,22 +2298,26 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; + #line 1676 "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 2308 "Python/generated_cases.c.h" STACK_SHRINK(2); PREDICT(JUMP_BACKWARD); DISPATCH(); } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { + #line 1685 "Python/bytecodes.c" _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; // cancel out the decrement that will happen in LOAD_SUPER_ATTR; we // don't want to specialize instrumented instructions INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(LOAD_SUPER_ATTR); + #line 2321 "Python/generated_cases.c.h" } TARGET(LOAD_SUPER_ATTR) { @@ -2048,6 +2328,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; + #line 1699 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2089,13 +2370,16 @@ } } } + #line 2374 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); + #line 1741 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; + #line 2383 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2110,16 +2394,20 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; + #line 1748 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); + #line 2405 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); + #line 1755 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; + #line 2411 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2134,6 +2422,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; + #line 1759 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2156,6 +2445,7 @@ res = res2; res2 = NULL; } + #line 2449 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; stack_pointer[-2] = res2; @@ -2169,6 +2459,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; + #line 1798 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2202,7 +2493,9 @@ NULL | meth | arg1 | ... | argN */ + #line 2497 "Python/generated_cases.c.h" Py_DECREF(owner); + #line 1832 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2211,9 +2504,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); + #line 2508 "Python/generated_cases.c.h" Py_DECREF(owner); + #line 1841 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } + #line 2513 "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; } @@ -2227,6 +2523,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); + #line 1846 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2239,6 +2536,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; + #line 2540 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2253,6 +2551,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); + #line 1862 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2278,6 +2577,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; + #line 2581 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2292,6 +2592,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); + #line 1891 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2342,6 +2643,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; + #line 2647 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2356,6 +2658,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); + #line 1945 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2365,6 +2668,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; + #line 2672 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2379,6 +2683,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); + #line 1958 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2390,6 +2695,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); + #line 2699 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2403,6 +2709,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 1973 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2426,6 +2733,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); + #line 2737 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2433,6 +2741,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 1999 "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); @@ -2458,6 +2767,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); + #line 2771 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2465,6 +2775,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 2027 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2482,6 +2793,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); + #line 2797 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2492,6 +2804,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 2047 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2530,6 +2843,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); + #line 2847 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2540,6 +2854,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 2088 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2549,6 +2864,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); + #line 2868 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2560,6 +2876,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; + #line 2107 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2572,9 +2889,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); + #line 2893 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); + #line 2120 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 2898 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2585,6 +2905,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; + #line 2124 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2595,6 +2916,7 @@ _Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; + #line 2920 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2605,6 +2927,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; + #line 2138 "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); @@ -2619,6 +2942,7 @@ _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; + #line 2946 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2629,6 +2953,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; + #line 2156 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2640,6 +2965,7 @@ assert((oparg & 0xf) == COMPARISON_NOT_EQUALS || (oparg & 0xf) == COMPARISON_EQUALS); assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; + #line 2969 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2650,10 +2976,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; + #line 2170 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; + #line 2982 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); + #line 2172 "Python/bytecodes.c" b = res ? Py_True : Py_False; + #line 2987 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2663,11 +2993,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; + #line 2176 "Python/bytecodes.c" int res = PySequence_Contains(right, left); + #line 2999 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); + #line 2178 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; + #line 3005 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2678,9 +3012,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; + #line 2183 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { + #line 3018 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); + #line 2185 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2688,8 +3025,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); + #line 3029 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); + #line 2193 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2698,6 +3037,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } + #line 3041 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -2707,15 +3047,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; + #line 2204 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { + #line 3054 "Python/generated_cases.c.h" Py_DECREF(right); + #line 2207 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); + #line 3061 "Python/generated_cases.c.h" Py_DECREF(right); + #line 2212 "Python/bytecodes.c" b = res ? Py_True : Py_False; + #line 3065 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -2724,12 +3070,16 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; + #line 2216 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = _PyImport_ImportName( tstate, BUILTINS(), GLOBALS(), LOCALS(), name, fromlist, level); + #line 3078 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); + #line 2220 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 3083 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2739,6 +3089,7 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; + #line 2224 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (_PyImport_IsLazyImportsActive(tstate)) { res = _PyImport_LazyImportName( @@ -2747,9 +3098,12 @@ res = _PyImport_ImportName( tstate, BUILTINS(), GLOBALS(), LOCALS(), name, fromlist, level); } + #line 3102 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); + #line 2233 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 3107 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2758,6 +3112,7 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; + #line 2237 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyLazyImport_CheckExact(from)) { res = _PyImport_LazyImportFrom(tstate, from, name); @@ -2765,20 +3120,25 @@ res = _PyImport_ImportFrom(tstate, from, name); } if (res == NULL) goto error; + #line 3124 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { + #line 2247 "Python/bytecodes.c" JUMPBY(oparg); + #line 3133 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); + #line 2251 "Python/bytecodes.c" assert(oparg < INSTR_OFFSET()); JUMPBY(-oparg); + #line 3142 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } @@ -2786,12 +3146,15 @@ TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; + #line 2257 "Python/bytecodes.c" if (Py_IsFalse(cond)) { JUMPBY(oparg); } else if (!Py_IsTrue(cond)) { int err = PyObject_IsTrue(cond); + #line 3156 "Python/generated_cases.c.h" Py_DECREF(cond); + #line 2263 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -2799,18 +3162,22 @@ if (err < 0) goto pop_1_error; } } + #line 3166 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; + #line 2273 "Python/bytecodes.c" if (Py_IsTrue(cond)) { JUMPBY(oparg); } else if (!Py_IsFalse(cond)) { int err = PyObject_IsTrue(cond); + #line 3179 "Python/generated_cases.c.h" Py_DECREF(cond); + #line 2279 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -2818,50 +3185,63 @@ if (err < 0) goto pop_1_error; } } + #line 3189 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; + #line 2289 "Python/bytecodes.c" if (!Py_IsNone(value)) { + #line 3198 "Python/generated_cases.c.h" Py_DECREF(value); + #line 2291 "Python/bytecodes.c" JUMPBY(oparg); } + #line 3203 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; + #line 2296 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { + #line 3215 "Python/generated_cases.c.h" Py_DECREF(value); + #line 2301 "Python/bytecodes.c" } + #line 3219 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { + #line 2305 "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 3232 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; + #line 2314 "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 3245 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -2872,13 +3252,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; + #line 2322 "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 3261 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); + #line 2327 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -2886,6 +3269,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } + #line 3273 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -2894,8 +3278,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; + #line 2337 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; + #line 3285 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2905,8 +3291,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; + #line 2343 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; + #line 3298 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2917,9 +3305,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; + #line 2349 "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 3313 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -2928,10 +3318,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; + #line 2355 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); + #line 3325 "Python/generated_cases.c.h" Py_DECREF(iterable); + #line 2358 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; + #line 3329 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -2939,6 +3333,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; + #line 2362 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -2961,8 +3356,11 @@ if (iter == NULL) { goto error; } + #line 3360 "Python/generated_cases.c.h" Py_DECREF(iterable); + #line 2385 "Python/bytecodes.c" } + #line 3364 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -2973,6 +3371,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; + #line 2404 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3003,6 +3402,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator + #line 3406 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3010,6 +3410,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { + #line 2437 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3035,12 +3436,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); + #line 3440 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; + #line 2465 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3060,6 +3463,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator + #line 3467 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3069,6 +3473,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; + #line 2487 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3088,6 +3493,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator + #line 3497 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3097,6 +3503,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; + #line 2509 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3114,6 +3521,7 @@ if (next == NULL) { goto error; } + #line 3525 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3122,6 +3530,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; + #line 2529 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3137,12 +3546,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); + #line 3550 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; + #line 2547 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3165,13 +3576,16 @@ Py_DECREF(enter); goto error; } + #line 3580 "Python/generated_cases.c.h" Py_DECREF(mgr); + #line 2570 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } + #line 3589 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3183,6 +3597,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; + #line 2580 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3208,13 +3623,16 @@ Py_DECREF(enter); goto error; } + #line 3627 "Python/generated_cases.c.h" Py_DECREF(mgr); + #line 2606 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } + #line 3636 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3226,6 +3644,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; + #line 2615 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3251,6 +3670,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; + #line 3674 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3259,6 +3679,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; + #line 2643 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3268,6 +3689,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); + #line 3693 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3281,6 +3703,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 2655 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3297,6 +3720,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); + #line 3724 "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; } @@ -3310,6 +3734,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); + #line 2674 "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); @@ -3319,6 +3744,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); + #line 3748 "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; } @@ -3332,6 +3758,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); + #line 2686 "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; @@ -3345,6 +3772,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); + #line 3776 "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; } @@ -3353,13 +3781,16 @@ } TARGET(KW_NAMES) { + #line 2702 "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 3789 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { + #line 2708 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3372,6 +3803,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); + #line 3807 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3381,6 +3813,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2753 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3462,6 +3895,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 3899 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3473,6 +3907,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; + #line 2841 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3482,6 +3917,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); + #line 3921 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3490,6 +3926,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); + #line 2853 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3515,6 +3952,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); + #line 3956 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3522,6 +3960,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); + #line 2881 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3557,6 +3996,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); + #line 4000 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -3564,6 +4004,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2919 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3573,6 +4014,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable + #line 4018 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3585,6 +4027,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2931 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3595,6 +4038,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4042 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3608,6 +4052,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2945 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3618,6 +4063,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4067 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3631,6 +4077,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2959 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3652,6 +4099,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4103 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3665,6 +4113,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2984 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3692,6 +4141,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4145 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3705,6 +4155,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3015 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3736,6 +4187,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ + #line 4191 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3749,6 +4201,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3050 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -3780,6 +4233,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4237 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3793,6 +4247,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3085 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -3817,6 +4272,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4276 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3829,6 +4285,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3112 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -3855,6 +4312,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4316 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3866,6 +4324,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; + #line 3142 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); PyInterpreterState *interp = _PyInterpreterState_GET(); @@ -3883,12 +4342,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); + #line 4346 "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 3162 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -3919,6 +4380,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4384 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3931,6 +4393,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3196 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3959,6 +4422,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4426 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3971,6 +4435,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3228 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -3999,6 +4464,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4468 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4011,6 +4477,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3260 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4038,6 +4505,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4509 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4047,7 +4515,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { + #line 3291 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); + #line 4521 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4056,6 +4526,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; + #line 3295 "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)); @@ -4117,11 +4588,14 @@ } result = PyObject_Call(func, callargs, kwargs); } + #line 4592 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); + #line 3357 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } + #line 4599 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4136,6 +4610,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 3367 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4164,12 +4639,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; + #line 4643 "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 3398 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4190,6 +4667,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; + #line 4671 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4197,11 +4675,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; + #line 3421 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); + #line 4681 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); + #line 3423 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } + #line 4687 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4212,6 +4694,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 3427 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4246,6 +4729,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 4733 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4254,8 +4738,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; + #line 3464 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); + #line 4745 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4267,6 +4753,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; + #line 3469 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4281,9 +4768,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); + #line 4772 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); + #line 3484 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 4777 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4293,13 +4783,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; + #line 3489 "Python/bytecodes.c" assert(oparg >= 2); + #line 4789 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { + #line 3493 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4311,20 +4804,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); + #line 4808 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { + #line 3507 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); + #line 4814 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { + #line 3511 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr-oparg, PY_MONITORING_EVENT_JUMP); + #line 4821 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { + #line 3516 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4333,10 +4832,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); + #line 4836 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { + #line 3527 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4345,10 +4846,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); + #line 4850 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { + #line 3538 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4360,10 +4863,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); + #line 4867 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { + #line 3552 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4375,23 +4880,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); + #line 4884 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { + #line 3566 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); + #line 4895 "Python/generated_cases.c.h" } TARGET(CACHE) { + #line 3574 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); + #line 4902 "Python/generated_cases.c.h" } TARGET(RESERVED) { + #line 3579 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); + #line 4909 "Python/generated_cases.c.h" }