[pypy-issue] Issue #2181: RPython Generators don't deal with raising other exception kinds (pypy/pypy)

Carl Friedrich Bolz issues-reply at bitbucket.org
Mon Nov 2 15:46:17 EST 2015


New issue 2181: RPython Generators don't deal with raising other exception kinds
https://bitbucket.org/pypy/pypy/issues/2181/rpython-generators-dont-deal-with-raising

Carl Friedrich Bolz:

This test fails:
```
    def test_different_exception(self):
        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
```

because the flow space assumes that .next can only raise StopIteration.




More information about the pypy-issue mailing list