mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
Use _PyErr_ChainStackItem() inside gen_send_ex(). (GH-20173) (#20202)
_PyErr_ChainStackItem was just added in GH-19951 (for bpo-31033).
(cherry picked from commit ff7a8b03c4
)
Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
This commit is contained in:
parent
1bf757884a
commit
f02c3048dc
1 changed files with 2 additions and 10 deletions
|
@ -203,16 +203,8 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc, int closing)
|
||||||
assert(f->f_back == NULL);
|
assert(f->f_back == NULL);
|
||||||
f->f_back = tstate->frame;
|
f->f_back = tstate->frame;
|
||||||
|
|
||||||
_PyErr_StackItem *gi_exc_state = &gen->gi_exc_state;
|
if (exc) {
|
||||||
if (exc && gi_exc_state->exc_type != NULL &&
|
_PyErr_ChainStackItem(&gen->gi_exc_state);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gen->gi_running = 1;
|
gen->gi_running = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue