summaryrefslogtreecommitdiff
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 9aaddd99ed..2c524ab7e0 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2650,32 +2650,25 @@ handle_eval_breaker:
}
assert (gen_status == PYGEN_NEXT);
assert (retval != NULL);
- frame->f_state = FRAME_SUSPENDED;
- _PyFrame_SetStackPointer(frame, stack_pointer);
- TRACE_FUNCTION_EXIT();
- DTRACE_FUNCTION_EXIT();
- _Py_LeaveRecursiveCall(tstate);
- /* Restore previous cframe and return. */
- tstate->cframe = cframe.previous;
- tstate->cframe->use_tracing = cframe.use_tracing;
- assert(tstate->cframe->current_frame == frame->previous);
- assert(!_PyErr_Occurred(tstate));
- return retval;
+ PUSH(retval);
+ DISPATCH();
+ }
+
+ TARGET(ASYNC_GEN_WRAP) {
+ PyObject *v = TOP();
+ assert(frame->f_code->co_flags & CO_ASYNC_GENERATOR);
+ PyObject *w = _PyAsyncGenValueWrapperNew(v);
+ if (w == NULL) {
+ goto error;
+ }
+ SET_TOP(w);
+ Py_DECREF(v);
+ DISPATCH();
}
TARGET(YIELD_VALUE) {
assert(frame->is_entry);
PyObject *retval = POP();
-
- if (frame->f_code->co_flags & CO_ASYNC_GENERATOR) {
- PyObject *w = _PyAsyncGenValueWrapperNew(retval);
- Py_DECREF(retval);
- if (w == NULL) {
- retval = NULL;
- goto error;
- }
- retval = w;
- }
frame->f_state = FRAME_SUSPENDED;
_PyFrame_SetStackPointer(frame, stack_pointer);
TRACE_FUNCTION_EXIT();