Skip to content

Commit

Permalink
Use _PyErr_ChainStackItem() inside gen_send_ex(). (pythonGH-20173) (p…
Browse files Browse the repository at this point in the history
…ython#20202)

_PyErr_ChainStackItem was just added in pythonGH-19951 (for bpo-31033).
(cherry picked from commit ff7a8b0)

Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>

Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
  • Loading branch information
miss-islington and cjerdonek authored May 19, 2020
1 parent 1bf7578 commit f02c304
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f02c304

Please sign in to comment.