[pypy-svn] r4794 - pypy/trunk/src/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Tue Jun 1 11:37:16 CEST 2004


Author: arigo
Date: Tue Jun  1 11:37:15 2004
New Revision: 4794

Modified:
   pypy/trunk/src/pypy/interpreter/error.py
   pypy/trunk/src/pypy/interpreter/gateway.py
   pypy/trunk/src/pypy/interpreter/py.py
Log:
Trying to run  py.py -S 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	Tue Jun  1 11:37:15 2004
@@ -162,11 +162,12 @@
             self.file.write('\n')
 
 # installing the excepthook for OperationErrors
-def operr_excepthook(exctype, value, traceback):
-    if issubclass(exctype, OperationError):
-        value.debug_tbs.append(traceback)
-        value.print_detailed_traceback()
-    else:
-        old_excepthook(exctype, value, traceback)
-old_excepthook = sys.excepthook
-sys.excepthook = operr_excepthook
+if hasattr(sys, 'excepthook'):   # not implemented on PyPy
+    def operr_excepthook(exctype, value, traceback):
+        if issubclass(exctype, OperationError):
+            value.debug_tbs.append(traceback)
+            value.print_detailed_traceback()
+        else:
+            old_excepthook(exctype, value, traceback)
+    old_excepthook = sys.excepthook
+    sys.excepthook = operr_excepthook

Modified: pypy/trunk/src/pypy/interpreter/gateway.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/gateway.py	(original)
+++ pypy/trunk/src/pypy/interpreter/gateway.py	Tue Jun  1 11:37:15 2004
@@ -11,7 +11,10 @@
 """
 
 import types
-from weakref import WeakKeyDictionary
+try:
+    from weakref import WeakKeyDictionary
+except ImportError:
+    WeakKeyDictionary = dict   # XXX for PyPy
 from pypy.interpreter import eval, pycode
 from pypy.interpreter.baseobjspace import Wrappable, ObjSpace
 from pypy.interpreter.function import Function, Method

Modified: pypy/trunk/src/pypy/interpreter/py.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/py.py	(original)
+++ pypy/trunk/src/pypy/interpreter/py.py	Tue Jun  1 11:37:15 2004
@@ -1,6 +1,10 @@
 #!/usr/bin/env python 
 
-import autopath
+try:
+    import autopath
+except ImportError:
+    pass
+
 from pypy.tool import option
 from pypy.tool.optik import make_option
 from pypy.interpreter import main, interactive, baseobjspace, error



More information about the Pypy-commit mailing list