Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r57456:67917d247fa5
Date: 2012-09-21 19:13 +0200
http://bitbucket.org/pypy/pypy/changeset/67917d247fa5/

Log:    fix test_raise.test_with_reraise_2 by restoring the current
        exception after having called contetmanager's __exit__()

diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -924,6 +924,7 @@
                       isinstance(unroller, SApplicationException))
         if is_app_exc:
             operr = unroller.operr
+            old_last_exception = self.last_exception
             self.last_exception = operr
             w_traceback = self.space.wrap(operr.get_traceback())
             w_suppress = self.call_contextmanager_exit_function(
@@ -931,6 +932,7 @@
                 operr.w_type,
                 operr.get_w_value(self.space),
                 w_traceback)
+            self.last_exception = old_last_exception
             if self.space.is_true(w_suppress):
                 # __exit__() returned True -> Swallow the exception.
                 self.settopvalue(self.space.w_None)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to