summaryrefslogtreecommitdiffstats
path: root/Objects/genobject.c
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@gmail.com>2017-03-12 19:53:07 (GMT)
committerGitHub <noreply@github.com>2017-03-12 19:53:07 (GMT)
commitb7c9150b68516878175e5373983189d6deea470c (patch)
treefa75438db1961d80c67986809c1c91e934089308 /Objects/genobject.c
parent2b27e2e6a35c3d3e369612b984017fe0d1bfcf0c (diff)
downloadcpython-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.c3
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);