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=16588229023bc5a3dc07d0386289ed6b3ceeddb7;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()