diff options
author | Damien George <damien.p.george@gmail.com> | 2019-09-30 16:06:20 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-10-04 23:27:00 +1000 |
commit | 809d89c794ceb44760ab997ff9a496488b4a2c0c (patch) | |
tree | 73d64b0977c0bc078144cbff18a47e4db86ff0ca /tests/basics/generator_pep479.py | |
parent | 82c494a97e874912e7eb23d2f03f39212e343fb3 (diff) |
py/runtime: Fix PEP479 behaviour throwing StopIteration into yield from.
Commit 3f6ffe059f64b3ebc44dc0bbc63452cb8850702b implemented PEP479 but did
not catch the case fixed in this commit. Found by coverage analysis, that
the VM had uncovered code.
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') |