[pypy-svn] r29837 - pypy/dist/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Sat Jul 8 16:19:53 CEST 2006


Author: arigo
Date: Sat Jul  8 16:19:51 2006
New Revision: 29837

Modified:
   pypy/dist/pypy/interpreter/error.py
   pypy/dist/pypy/interpreter/pyframe.py
Log:
On non-translated PyPy, record by default the interp-level traceback
and restore it in pyframe.  This makes uncaught interp-level OperationErrors
produce a reasonable traceback when they crash the host Python.


Modified: pypy/dist/pypy/interpreter/error.py
==============================================================================
--- pypy/dist/pypy/interpreter/error.py	(original)
+++ pypy/dist/pypy/interpreter/error.py	Sat Jul  8 16:19:51 2006
@@ -2,7 +2,7 @@
 import os, sys
 
 AUTO_DEBUG = os.getenv('PYPY_DEBUG')
-RECORD_INTERPLEVEL_TRACEBACK = False
+RECORD_INTERPLEVEL_TRACEBACK = True
 
 
 class OperationError(Exception):

Modified: pypy/dist/pypy/interpreter/pyframe.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyframe.py	(original)
+++ pypy/dist/pypy/interpreter/pyframe.py	Sat Jul  8 16:19:51 2006
@@ -633,7 +633,16 @@
 
     def emptystack(self, frame):
         # propagate the exception to the caller
-        raise self.operr
+        from pypy.rpython.objectmodel import we_are_translated
+        if we_are_translated():
+            raise self.operr
+        else:
+            # try to preserve the interp-level traceback
+            if self.operr.debug_excs:
+                _, _, tb = self.operr.debug_excs[-1]
+            else:
+                tb = None
+            raise OperationError, self.operr, tb
 
     def state_unpack_variables(self, space):
         return [self.operr.w_type, self.operr.w_value]



More information about the Pypy-commit mailing list