File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -1103,7 +1103,27 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
1103
1103
}
1104
1104
else if (f -> f_execute == slp_eval_frame_yield_from ) {
1105
1105
/* finalise the YIELD_FROM operation */
1106
- goto stackless_yield_from_return ;
1106
+ PyObject * receiver = TOP ();
1107
+ if (retval == NULL ) {
1108
+ int err ;
1109
+ if (tstate -> c_tracefunc != NULL
1110
+ && PyErr_ExceptionMatches (PyExc_StopIteration ))
1111
+ call_exc_trace (tstate -> c_tracefunc , tstate -> c_traceobj , tstate , f );
1112
+ err = _PyGen_FetchStopIterationValue (& retval );
1113
+ if (err < 0 )
1114
+ goto error ;
1115
+ Py_DECREF (receiver );
1116
+ SET_TOP (retval );
1117
+ }
1118
+ else {
1119
+ /* receiver remains on stack, retval is value to be yielded */
1120
+ f -> f_stacktop = stack_pointer ;
1121
+ why = WHY_YIELD ;
1122
+ /* and repeat... */
1123
+ assert (f -> f_lasti >= (int )sizeof (_Py_CODEUNIT ));
1124
+ f -> f_lasti -= sizeof (_Py_CODEUNIT );
1125
+ goto fast_yield ;
1126
+ }
1107
1127
}
1108
1128
else
1109
1129
Py_FatalError ("invalid frame function" );
@@ -1997,7 +2017,6 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
1997
2017
#ifdef STACKLESS
1998
2018
if (STACKLESS_UNWINDING (retval )) {
1999
2019
HANDLE_UNWINDING (slp_eval_frame_yield_from , 0 , retval );
2000
- stackless_yield_from_return :
2001
2020
receiver = TOP ();
2002
2021
}
2003
2022
#endif
You can’t perform that action at this time.
0 commit comments