diff --git a/Objects/genobject.c b/Objects/genobject.c index 5ae8512f540..149e545ec06 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -151,6 +151,7 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc) PyErr_NormalizeException(&exc, &val2, &tb); PyException_SetCause(val2, val); PyException_SetContext(val2, val); + Py_INCREF(val); PyErr_Restore(exc, val2, tb); } }