mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Fix wrapping into StopIteration of return values in generators and coroutines (#644)
This commit is contained in:
parent
2b27e2e6a3
commit
b7c9150b68
2 changed files with 16 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue