summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-06-04 12:23:35 (GMT)
committerGitHub <noreply@github.com>2020-06-04 12:23:35 (GMT)
commit50a48dad5579d67d7cae350f6ad5ae5c33f56abb (patch)
treecaba0849e1ea3e65a0f6c3cd933d5b4a6bd21138 /Objects
parent6e23a9c82b7fd2366003b9191cd93a9683b9d80c (diff)
downloadcpython-50a48dad5579d67d7cae350f6ad5ae5c33f56abb.zip
cpython-50a48dad5579d67d7cae350f6ad5ae5c33f56abb.tar.gz
cpython-50a48dad5579d67d7cae350f6ad5ae5c33f56abb.tar.bz2
Don't raise an exception on normal return from generator. (GH-19473)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/genobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 09efbab..1393f42 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -231,7 +231,8 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc, int closing)
if (PyAsyncGen_CheckExact(gen)) {
PyErr_SetNone(PyExc_StopAsyncIteration);
}
- else {
+ else if (arg) {
+ /* Set exception if not called by gen_iternext() */
PyErr_SetNone(PyExc_StopIteration);
}
}