summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@gmail.com>2017-03-12 21:03:46 (GMT)
committerGitHub <noreply@github.com>2017-03-12 21:03:46 (GMT)
commit216803d8e10615c769571fbfbd1f341557f25a14 (patch)
treed4f31dc6996a9110835bc6602c3c2c37d14605ce /Objects
parenta16894ebf8823f0e09036aacde9288c00e8d9058 (diff)
downloadcpython-216803d8e10615c769571fbfbd1f341557f25a14.zip
cpython-216803d8e10615c769571fbfbd1f341557f25a14.tar.gz
cpython-216803d8e10615c769571fbfbd1f341557f25a14.tar.bz2
Fix wrapping into StopIteration of return values in generators and coroutines (#644) (#648)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/genobject.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c
index d403598..0de5408 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -466,8 +466,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);