Commit 9c12fde7 authored by Stefan Behnel's avatar Stefan Behnel

extended test case: coroutine.throw() while handling an exception already

parent 401edbb2
......@@ -167,6 +167,40 @@ def check_yield_in_except():
except ValueError:
yield
def yield_in_except_throw_exc_type():
"""
>>> import sys
>>> g = yield_in_except_throw_exc_type()
>>> next(g)
>>> g.throw(TypeError)
Traceback (most recent call last):
TypeError
>>> next(g)
Traceback (most recent call last):
StopIteration
"""
try:
raise ValueError
except ValueError:
yield
def yield_in_except_throw_instance():
"""
>>> import sys
>>> g = yield_in_except_throw_instance()
>>> next(g)
>>> g.throw(TypeError())
Traceback (most recent call last):
TypeError
>>> next(g)
Traceback (most recent call last):
StopIteration
"""
try:
raise ValueError
except ValueError:
yield
def test_swap_assignment():
"""
>>> gen = test_swap_assignment()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment