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

arigo at codespeak.net arigo at codespeak.net
Sun May 1 20:04:05 CEST 2005


Author: arigo
Date: Sun May  1 20:04:05 2005
New Revision: 11718

Modified:
   pypy/dist/pypy/interpreter/error.py
   pypy/dist/pypy/interpreter/py.py
Log:
Recording interp-level tracebacks has the bad side effects of keeping more
objects alive than generally expected (at least by CPython's tests).

So don't record them unless py.py runs in verbose mode (-v option or PYPY_TB
env var).  These tracebacks are not visible without verbose mode, anyway --
not to mention not very useful at all.


Modified: pypy/dist/pypy/interpreter/error.py
==============================================================================
--- pypy/dist/pypy/interpreter/error.py	(original)
+++ pypy/dist/pypy/interpreter/error.py	Sun May  1 20:04:05 2005
@@ -2,6 +2,7 @@
 import os, sys
 
 AUTO_DEBUG = os.getenv('PYPY_DEBUG')
+RECORD_INTERPLEVEL_TRACEBACK = False
 
 
 class OperationError(Exception):
@@ -64,10 +65,11 @@
             return None
 
     def record_interpreter_traceback(self):
-        """NOT_RPYTHON: Records the current traceback inside the interpreter.
+        """Records the current traceback inside the interpreter.
         This traceback is only useful to debug the interpreter, not the
         application."""
-        self.debug_excs.append(sys.exc_info())
+        if RECORD_INTERPLEVEL_TRACEBACK:
+            self.debug_excs.append(sys.exc_info())
 
     def print_application_traceback(self, space, file=None):
         "NOT_RPYTHON: Dump a standard application-level traceback."

Modified: pypy/dist/pypy/interpreter/py.py
==============================================================================
--- pypy/dist/pypy/interpreter/py.py	(original)
+++ pypy/dist/pypy/interpreter/py.py	Sun May  1 20:04:05 2005
@@ -65,6 +65,8 @@
             "running py.py should not import pypy.tool.udir, which is\n"
             "only for testing or translating purposes.")
         go_interactive = Options.interactive
+        if Options.verbose:
+            error.RECORD_INTERPLEVEL_TRACEBACK = True
         banner = ''
         space.setitem(space.sys.w_dict,space.wrap('executable'),space.wrap(argv[0]))
         if Options.command:



More information about the Pypy-commit mailing list