Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r68958:beafaef52b05 Date: 2014-01-27 00:36 +0100 http://bitbucket.org/pypy/pypy/changeset/beafaef52b05/
Log: Test and fix diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py --- a/pypy/interpreter/pyopcode.py +++ b/pypy/interpreter/pyopcode.py @@ -744,6 +744,9 @@ else: raise OperationError(space.w_TypeError, space.wrap("raise: no active exception to re-raise")) + if operror.w_type is space.w_None: + raise OperationError(space.w_TypeError, + space.wrap("raise: the exception to re-raise was cleared")) # re-raise, no new traceback obj will be attached self.last_exception = operror raise RaiseWithExplicitTraceback(operror) diff --git a/pypy/interpreter/test/test_interpreter.py b/pypy/interpreter/test/test_interpreter.py --- a/pypy/interpreter/test/test_interpreter.py +++ b/pypy/interpreter/test/test_interpreter.py @@ -371,3 +371,13 @@ def h1(): sys.exc_clear() f() + + def test_sys_clear_reraise(self): + import sys + def f(): + try: + 1 / 0 + except ZeroDivisionError: + sys.exc_clear() + raise + raises(TypeError, f) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit