diff options
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r-- | Python/generated_cases.c.h | 82 |
1 files changed, 4 insertions, 78 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index fa1f941..0d4dad4 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -684,22 +684,14 @@ DISPATCH(); } - TARGET(PRINT_EXPR) { + TARGET(CALL_INTRINSIC_1) { PyObject *value = PEEK(1); - PyObject *hook = _PySys_GetAttr(tstate, &_Py_ID(displayhook)); PyObject *res; - // Can't use ERROR_IF here. - if (hook == NULL) { - _PyErr_SetString(tstate, PyExc_RuntimeError, - "lost sys.displayhook"); - Py_DECREF(value); - if (true) goto pop_1_error; - } - res = PyObject_CallOneArg(hook, value); + assert(oparg <= MAX_INTRINSIC_1); + res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); Py_DECREF(value); if (res == NULL) goto pop_1_error; - Py_DECREF(res); - STACK_SHRINK(1); + POKE(1, res); DISPATCH(); } @@ -1045,48 +1037,6 @@ DISPATCH(); } - TARGET(STOPITERATION_ERROR) { - assert(frame->owner == FRAME_OWNED_BY_GENERATOR); - PyObject *exc = TOP(); - assert(PyExceptionInstance_Check(exc)); - const char *msg = NULL; - if (PyErr_GivenExceptionMatches(exc, PyExc_StopIteration)) { - msg = "generator raised StopIteration"; - if (frame->f_code->co_flags & CO_ASYNC_GENERATOR) { - msg = "async generator raised StopIteration"; - } - else if (frame->f_code->co_flags & CO_COROUTINE) { - msg = "coroutine raised StopIteration"; - } - } - else if ((frame->f_code->co_flags & CO_ASYNC_GENERATOR) && - PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) - { - /* code in `gen` raised a StopAsyncIteration error: - raise a RuntimeError. - */ - msg = "async generator raised StopAsyncIteration"; - } - if (msg != NULL) { - PyObject *message = _PyUnicode_FromASCII(msg, strlen(msg)); - if (message == NULL) { - goto error; - } - PyObject *error = PyObject_CallOneArg(PyExc_RuntimeError, message); - if (error == NULL) { - Py_DECREF(message); - goto error; - } - assert(PyExceptionInstance_Check(error)); - SET_TOP(error); - PyException_SetCause(error, Py_NewRef(exc)); - // Steal exc reference, rather than Py_NewRef+Py_DECREF - PyException_SetContext(error, exc); - Py_DECREF(message); - } - DISPATCH(); - } - TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; value = Py_NewRef(PyExc_AssertionError); @@ -2401,30 +2351,6 @@ DISPATCH(); } - TARGET(IMPORT_STAR) { - PyObject *from = PEEK(1); - PyObject *locals; - int err; - if (_PyFrame_FastToLocalsWithError(frame) < 0) { - Py_DECREF(from); - if (true) goto pop_1_error; - } - - locals = LOCALS(); - if (locals == NULL) { - _PyErr_SetString(tstate, PyExc_SystemError, - "no locals found during 'import *'"); - Py_DECREF(from); - if (true) goto pop_1_error; - } - err = import_all_from(tstate, locals, from); - _PyFrame_LocalsToFast(frame, 0); - Py_DECREF(from); - if (err) goto pop_1_error; - STACK_SHRINK(1); - DISPATCH(); - } - TARGET(IMPORT_FROM) { PyObject *from = PEEK(1); PyObject *res; |