Author: Armin Rigo <[email protected]>
Branch: py3.5-refactor-sys_exc_info
Changeset: r88441:4bbf0a7c9f6c
Date: 2016-11-17 15:03 +0000
http://bitbucket.org/pypy/pypy/changeset/4bbf0a7c9f6c/

Log:    Add a (passing) check for sys_exc_info being saved/restored in all
        cases

diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -248,8 +248,20 @@
         """Start this frame's execution."""
         if self._is_generator_or_coroutine():
             return self.initialize_as_generator(name, qualname)
+        elif we_are_translated():
+            return self.execute_frame()
         else:
-            return self.execute_frame()
+            # untranslated: check that sys_exc_info is exactly
+            # restored after running any Python function
+            executioncontext = self.space.getexecutioncontext()
+            exc_on_enter = executioncontext.sys_exc_info()
+            try:
+                w_res = self.execute_frame()
+            except OperationError:
+                assert exc_on_enter is executioncontext.sys_exc_info()
+                raise
+            assert exc_on_enter is executioncontext.sys_exc_info()
+            return w_res
     run._always_inline_ = True
 
     def initialize_as_generator(self, name, qualname):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to