diff options
author | Yury Selivanov <yselivanov@gmail.com> | 2017-03-12 19:53:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-12 19:53:07 (GMT) |
commit | b7c9150b68516878175e5373983189d6deea470c (patch) | |
tree | fa75438db1961d80c67986809c1c91e934089308 /Objects/genobject.c | |
parent | 2b27e2e6a35c3d3e369612b984017fe0d1bfcf0c (diff) | |
download | cpython-b7c9150b68516878175e5373983189d6deea470c.zip cpython-b7c9150b68516878175e5373983189d6deea470c.tar.gz cpython-b7c9150b68516878175e5373983189d6deea470c.tar.bz2 |
Fix wrapping into StopIteration of return values in generators and coroutines (#644)
Diffstat (limited to 'Objects/genobject.c')
-rw-r--r-- | Objects/genobject.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c index 24a1da6..8c2213e 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -574,8 +574,7 @@ _PyGen_SetStopIterationValue(PyObject *value) PyObject *e; if (value == NULL || - (!PyTuple_Check(value) && - !PyObject_TypeCheck(value, (PyTypeObject *) PyExc_StopIteration))) + (!PyTuple_Check(value) && !PyExceptionInstance_Check(value))) { /* Delay exception instantiation if we can */ PyErr_SetObject(PyExc_StopIteration, value); |