[pypy-commit] pypy py3.5: Fix interpreter/test/test_raise:test_context_with_suppressed by
arigo
pypy.commits at gmail.com
Sun Oct 9 13:51:41 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r87675:6fe3befdcc99
Date: 2016-10-09 19:51 +0200
http://bitbucket.org/pypy/pypy/changeset/6fe3befdcc99/
Log: Fix interpreter/test/test_raise:test_context_with_suppressed by
copying 7737b9ffdd0b, which was lost in some merge
Disclaimer: this might be still incomplete
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -1155,11 +1155,15 @@
old_last_exception = self.last_exception
self.last_exception = operr
w_traceback = self.space.wrap(operr.get_traceback())
- w_res = self.call_contextmanager_exit_function(
- w_exitfunc,
- operr.w_type,
- operr.get_w_value(self.space),
- w_traceback)
+ try:
+ w_res = self.call_contextmanager_exit_function(
+ w_exitfunc,
+ operr.w_type,
+ operr.get_w_value(self.space),
+ w_traceback)
+ except:
+ self.last_exception = old_last_exception
+ raise
# push a marker that also contains the old_last_exception,
# which must be restored as 'self.last_exception' but only
# in WITH_CLEANUP_FINISH
More information about the pypy-commit
mailing list