Better behavior when stepping over yield[from]. Fixes issue 16596. By Xavier de Gaye.

This commit is contained in:
Guido van Rossum 2013-11-21 11:30:06 -08:00
parent 9c55a58a1d
commit 8820c239f7
4 changed files with 351 additions and 7 deletions

View file

@ -1904,6 +1904,9 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_DECREF(v);
if (retval == NULL) {
PyObject *val;
if (tstate->c_tracefunc != NULL
&& PyErr_ExceptionMatches(PyExc_StopIteration))
call_exc_trace(tstate->c_tracefunc, tstate->c_traceobj, f);
err = _PyGen_FetchStopIterationValue(&val);
if (err < 0)
goto error;
@ -2654,6 +2657,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
if (PyErr_Occurred()) {
if (!PyErr_ExceptionMatches(PyExc_StopIteration))
goto error;
else if (tstate->c_tracefunc != NULL)
call_exc_trace(tstate->c_tracefunc, tstate->c_traceobj, f);
PyErr_Clear();
}
/* iterator ended normally */