Including more GeneratorExit and StopAsyncIteration in the ignored exceptions for Python

This commit is contained in:
Matthias Koefferlein 2024-07-27 14:29:14 +02:00
parent 071326ffee
commit b253eaa51a
1 changed files with 5 additions and 1 deletions

View File

@ -684,7 +684,11 @@ PythonInterpreter::trace_func (PyFrameObject *frame, int event, PyObject *arg)
exc_value = PythonPtr (PyTuple_GetItem (arg, 1));
}
if (exc_type && exc_type.get () != PyExc_StopIteration) {
#if PY_VERSION_HEX >= 0x03050000
if (exc_type && exc_type.get () != PyExc_StopIteration && exc_type.get () != PyExc_GeneratorExit && exc_type.get () != PyExc_StopAsyncIteration) {
#else
if (exc_type && exc_type.get () != PyExc_StopIteration && exc_type.get () != PyExc_GeneratorExit) {
#endif
// If the next exception shall be ignored, do so
if (m_ignore_next_exception) {