Use _PyErr_ChainStackItem() inside gen_send_ex(). (GH-20173)
_PyErr_ChainStackItem was just added in GH-19951 (for bpo-31033).
This commit is contained in:
parent
a3ec3ad9e2
commit
ff7a8b03c4
|
@ -203,16 +203,8 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc, int closing)
|
|||
assert(f->f_back == NULL);
|
||||
f->f_back = tstate->frame;
|
||||
|
||||
_PyErr_StackItem *gi_exc_state = &gen->gi_exc_state;
|
||||
if (exc && gi_exc_state->exc_type != NULL &&
|
||||
gi_exc_state->exc_type != Py_None)
|
||||
{
|
||||
Py_INCREF(gi_exc_state->exc_type);
|
||||
Py_XINCREF(gi_exc_state->exc_value);
|
||||
Py_XINCREF(gi_exc_state->exc_traceback);
|
||||
_PyErr_ChainExceptions(gi_exc_state->exc_type,
|
||||
gi_exc_state->exc_value,
|
||||
gi_exc_state->exc_traceback);
|
||||
if (exc) {
|
||||
_PyErr_ChainStackItem(&gen->gi_exc_state);
|
||||
}
|
||||
|
||||
gen->gi_running = 1;
|
||||
|
|
Loading…
Reference in New Issue