From: Stefan Behnel Date: Thu, 28 Apr 2011 20:11:25 +0000 (+0200) Subject: extended test case: coroutine.throw() while handling an exception already X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9c12fde76b36238355a25ec2aedd6f48c4a62b9a;p=cython.git extended test case: coroutine.throw() while handling an exception already --- diff --git a/tests/run/generators_py.py b/tests/run/generators_py.py index 57a11d0a..b43962cd 100644 --- a/tests/run/generators_py.py +++ b/tests/run/generators_py.py @@ -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()