[pypy-svn] r5080 - pypy/trunk/src/pypy/interpreter
arigo at codespeak.net
arigo at codespeak.net
Sat Jun 12 18:04:23 CEST 2004
Author: arigo
Date: Sat Jun 12 18:04:23 2004
New Revision: 5080
Modified:
pypy/trunk/src/pypy/interpreter/error.py
pypy/trunk/src/pypy/interpreter/py.py
Log:
Removed our custom sys.excepthook and replaced it with an
except catching OperationErrors in py.py.
Modified: pypy/trunk/src/pypy/interpreter/error.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/error.py (original)
+++ pypy/trunk/src/pypy/interpreter/error.py Sat Jun 12 18:04:23 2004
@@ -95,8 +95,9 @@
interpr_file = LinePrefixer(file, '||')
print >> interpr_file, "Traceback (interpreter-level):"
traceback.print_tb(self.debug_excs[i][2], file=interpr_file)
- from pypy.tool import tb_server
- tb_server.publish_exc(self.debug_excs[-1])
+ if self.debug_excs:
+ from pypy.tool import tb_server
+ tb_server.publish_exc(self.debug_excs[-1])
self.print_app_tb_only(file)
if space is None:
exc_typename = str(self.w_type)
@@ -148,15 +149,15 @@
if self.linestart:
self.file.write('\n')
-# installing the excepthook for OperationErrors
-def operr_excepthook(exctype, value, traceback):
- if issubclass(exctype, OperationError):
- value.debug_excs.append((exctype, value, traceback))
- value.print_detailed_traceback()
- else:
- old_excepthook(exctype, value, traceback)
- from pypy.tool import tb_server
- tb_server.publish_exc((exctype, value, traceback))
+### installing the excepthook for OperationErrors
+##def operr_excepthook(exctype, value, traceback):
+## if issubclass(exctype, OperationError):
+## value.debug_excs.append((exctype, value, traceback))
+## value.print_detailed_traceback()
+## else:
+## old_excepthook(exctype, value, traceback)
+## from pypy.tool import tb_server
+## tb_server.publish_exc((exctype, value, traceback))
-old_excepthook = sys.excepthook
-sys.excepthook = operr_excepthook
+##old_excepthook = sys.excepthook
+##sys.excepthook = operr_excepthook
Modified: pypy/trunk/src/pypy/interpreter/py.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/py.py (original)
+++ pypy/trunk/src/pypy/interpreter/py.py Sat Jun 12 18:04:23 2004
@@ -34,6 +34,7 @@
def main_(argv=None):
from pypy.tool import tb_server
args = option.process_options(get_main_options(), Options, argv[1:])
+ space = None
try:
space = option.objspace()
go_interactive = Options.interactive
@@ -63,13 +64,14 @@
con.interact(banner)
except:
exc_type, value, tb = sys.exc_info()
- if (isinstance(exc_type, type(SystemExit)) and
- issubclass(exc_type, SystemExit)):
+ sys.last_type = exc_type
+ sys.last_value = value
+ sys.last_traceback = tb
+ if issubclass(exc_type, SystemExit):
pass # don't print tracebacks for SystemExit
+ elif isinstance(value, error.OperationError):
+ value.print_detailed_traceback(space=space)
else:
- sys.last_type = exc_type
- sys.last_value = value
- sys.last_traceback = tb
sys.excepthook(exc_type, value, tb)
tb_server.wait_until_interrupt()
More information about the Pypy-commit
mailing list