mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
py/runtime: Fix PEP479 behaviour throwing StopIteration into yield from.
Commit 3f6ffe059f implemented PEP479 but did
not catch the case fixed in this commit. Found by coverage analysis, that
the VM had uncovered code.
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user