From b7c9150b68516878175e5373983189d6deea470c Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Sun, 12 Mar 2017 15:53:07 -0400 Subject: Fix wrapping into StopIteration of return values in generators and coroutines (#644) --- Objects/genobject.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Objects/genobject.c') diff --git a/Objects/genobject.c b/Objects/genobject.c index 24a1da6f3e..8c2213e5bf 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); -- cgit v1.2.1