summaryrefslogtreecommitdiff
path: root/tests/basics
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-09-30 16:06:20 +1000
committerDamien George <damien.p.george@gmail.com>2019-10-04 23:27:00 +1000
commit809d89c794ceb44760ab997ff9a496488b4a2c0c (patch)
tree73d64b0977c0bc078144cbff18a47e4db86ff0ca /tests/basics
parent82c494a97e874912e7eb23d2f03f39212e343fb3 (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')
-rw-r--r--tests/basics/generator_pep479.py11
-rw-r--r--tests/basics/generator_pep479.py.exp2
2 files changed, 13 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')
diff --git a/tests/basics/generator_pep479.py.exp b/tests/basics/generator_pep479.py.exp
index c64fe4956..610133946 100644
--- a/tests/basics/generator_pep479.py.exp
+++ b/tests/basics/generator_pep479.py.exp
@@ -3,3 +3,5 @@ RuntimeError
StopIteration
1
RuntimeError
+0
+RuntimeError