diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-05-19 02:14:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-19 02:14:13 (GMT) |
commit | f02c3048dc2f22053a2ba56ef5987967b89c4be3 (patch) | |
tree | b6fec835404a6bfffdd80b101be6e829580f4969 | |
parent | 1bf757884a431e025ef5f1e84c34b3fbbbe5b792 (diff) | |
download | cpython-f02c3048dc2f22053a2ba56ef5987967b89c4be3.zip cpython-f02c3048dc2f22053a2ba56ef5987967b89c4be3.tar.gz cpython-f02c3048dc2f22053a2ba56ef5987967b89c4be3.tar.bz2 |
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 ff7a8b03c49153021d6de5d0b2fa8b5163059ed6)
Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
-rw-r--r-- | Objects/genobject.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c index 40179cd..271720b 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -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; |