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:
Chris Jerdonek 2020-05-18 15:36:09 -07:00 committed by GitHub
parent a3ec3ad9e2
commit ff7a8b03c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 10 deletions

View File

@ -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;