mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Better behavior when stepping over yield[from]. Fixes issue 16596. By Xavier de Gaye.
This commit is contained in:
parent
9c55a58a1d
commit
8820c239f7
4 changed files with 351 additions and 7 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue