[Python-checkins] Use _PyErr_ChainStackItem() inside gen_send_ex(). (GH-20173)
Chris Jerdonek
webhook-mailer at python.org
Mon May 18 18:36:18 EDT 2020
https://github.com/python/cpython/commit/ff7a8b03c49153021d6de5d0b2fa8b5163059ed6
commit: ff7a8b03c49153021d6de5d0b2fa8b5163059ed6
branch: master
author: Chris Jerdonek <chris.jerdonek at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-05-18T15:36:09-07:00
summary:
Use _PyErr_ChainStackItem() inside gen_send_ex(). (GH-20173)
_PyErr_ChainStackItem was just added in GH-19951 (for bpo-31033).
files:
M Objects/genobject.c
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 40179cdbf7dbd..271720bdf8b4c 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;
More information about the Python-checkins
mailing list