diff options
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index e2e882b..ab419dc 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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 */ |