From: Stefan Behnel Date: Sun, 17 Apr 2011 09:45:14 +0000 (+0200) Subject: added failing exception test for generators X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=87efa32463e4c2d8c5b14530a74d892ae7d1f810;p=cython.git added failing exception test for generators --- diff --git a/tests/run/generators_py.py b/tests/run/generators_py.py index ea16659a..ac364234 100644 --- a/tests/run/generators_py.py +++ b/tests/run/generators_py.py @@ -155,6 +155,22 @@ def check_throw(): except ValueError: pass +def check_yield_in_except(): + """ + >>> import sys + >>> orig_exc = sys.exc_info()[0] + >>> g = check_yield_in_except() + >>> next(g) + >>> next(g) + >>> orig_exc is sys.exc_info()[0] or sys.exc_info()[0] + True + """ + try: + yield + raise ValueError + except ValueError: + yield + def test_swap_assignment(): """ >>> gen = test_swap_assignment()