Issue #22906: Do incref before SetCause/SetContext
This commit is contained in:
parent
582d3fb1a5
commit
18c30a29f8
|
@ -149,9 +149,9 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc)
|
||||||
"generator raised StopIteration");
|
"generator raised StopIteration");
|
||||||
PyErr_Fetch(&exc, &val2, &tb);
|
PyErr_Fetch(&exc, &val2, &tb);
|
||||||
PyErr_NormalizeException(&exc, &val2, &tb);
|
PyErr_NormalizeException(&exc, &val2, &tb);
|
||||||
|
Py_INCREF(val);
|
||||||
PyException_SetCause(val2, val);
|
PyException_SetCause(val2, val);
|
||||||
PyException_SetContext(val2, val);
|
PyException_SetContext(val2, val);
|
||||||
Py_INCREF(val);
|
|
||||||
PyErr_Restore(exc, val2, tb);
|
PyErr_Restore(exc, val2, tb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue