Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: Changeset: r80505:f25d33c5dcec Date: 2015-11-02 21:44 +0100 http://bitbucket.org/pypy/pypy/changeset/f25d33c5dcec/
Log: generators are a bit broken diff --git a/rpython/rtyper/test/test_generator.py b/rpython/rtyper/test/test_generator.py --- a/rpython/rtyper/test/test_generator.py +++ b/rpython/rtyper/test/test_generator.py @@ -76,6 +76,31 @@ res = self.interpret(f, []) assert res == 358 + def test_different_exception(self): + py.test.skip("generators broken") + def h(c): + if c == 8: + raise ValueError + def g(c): + try: + h(c) + except Exception, e: + if isinstance(e, ValueError): + raise + raise StopIteration + yield c + + def f(x): + try: + for x in g(x): + pass + except ValueError: + return -5 + return 5 + assert f(8) == -5 + res = self.interpret(f, [8]) + assert res == -5 + def test_iterating_generator(self): def f(): yield 1 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit