diff options
Diffstat (limited to 'tests/basics/generator_pep479.py')
-rw-r--r-- | tests/basics/generator_pep479.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/basics/generator_pep479.py b/tests/basics/generator_pep479.py index e422c349e..538531217 100644 --- a/tests/basics/generator_pep479.py +++ b/tests/basics/generator_pep479.py @@ -27,3 +27,14 @@ try: g.throw(StopIteration) except RuntimeError: print('RuntimeError') + +# throwing a StopIteration through yield from, will be converted to a RuntimeError +def gen(): + yield from range(2) + print('should not get here') +g = gen() +print(next(g)) +try: + g.throw(StopIteration) +except RuntimeError: + print('RuntimeError') |