Commit 18c30a29 authored by Yury Selivanov's avatar Yury Selivanov

Issue #22906: Do incref before SetCause/SetContext

parent 582d3fb1
......@@ -149,9 +149,9 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc)
"generator raised StopIteration");
PyErr_Fetch(&exc, &val2, &tb);
PyErr_NormalizeException(&exc, &val2, &tb);
Py_INCREF(val);
PyException_SetCause(val2, val);
PyException_SetContext(val2, val);
Py_INCREF(val);
PyErr_Restore(exc, val2, tb);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment