[pypy-svn] r17099 - in pypy/dist/pypy: interpreter objspace

arigo at codespeak.net arigo at codespeak.net
Tue Aug 30 20:23:52 CEST 2005


Author: arigo
Date: Tue Aug 30 20:23:50 2005
New Revision: 17099

Modified:
   pypy/dist/pypy/interpreter/baseobjspace.py
   pypy/dist/pypy/interpreter/interactive.py
   pypy/dist/pypy/objspace/proxy.py
Log:
'sys.pypy_objspaceclass' was broken.  The proper fix is to not let the thunk
objspace store a modified __repr__ in the space instance -- that won't work
with repr().


Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py	Tue Aug 30 20:23:50 2005
@@ -143,7 +143,10 @@
         pass
 
     def __repr__(self):
-        return self.__class__.__name__
+        try:
+            return self._this_space_repr_
+        except AttributeError:
+            return self.__class__.__name__
 
     def setbuiltinmodule(self, importname, installed_builtin_modules=[]): 
         """NOT_RPYTHON. load a lazy pypy/module and put it into sys.modules"""

Modified: pypy/dist/pypy/interpreter/interactive.py
==============================================================================
--- pypy/dist/pypy/interpreter/interactive.py	(original)
+++ pypy/dist/pypy/interpreter/interactive.py	Tue Aug 30 20:23:50 2005
@@ -129,8 +129,8 @@
         w_sys = self.space.sys
         major, minor, micro, _, _ = self.space.unwrap(self.space.sys.get('pypy_version_info'))
         elapsed = time.time() - self.space._starttime
-        banner = "PyPy %d.%d.%d in %s on top of Python %s (startupttime: %.2f secs)" % (
-            major, minor, micro ,self.space.__repr__(), sys.version.split()[0], elapsed)
+        banner = "PyPy %d.%d.%d in %r on top of Python %s (startupttime: %.2f secs)" % (
+            major, minor, micro, self.space, sys.version.split()[0], elapsed)
         code.InteractiveConsole.interact(self, banner)
 
     def raw_input(self, prompt=""):

Modified: pypy/dist/pypy/objspace/proxy.py
==============================================================================
--- pypy/dist/pypy/objspace/proxy.py	(original)
+++ pypy/dist/pypy/objspace/proxy.py	Tue Aug 30 20:23:50 2005
@@ -17,7 +17,7 @@
         if proxy:
             setattr(space, name, proxy)
 
-    prevrepr = space.__repr__()
-    space.__repr__ = lambda: '%s(%s)' % (proxyname, prevrepr)
+    prevrepr = repr(space)
+    space._this_space_repr_ = '%s(%s)' % (proxyname, prevrepr)
 
 # __________________________________________________________________________



More information about the Pypy-commit mailing list