[pypy-svn] rev 737 - pypy/trunk/src/pypy/objspace/std

mwh at codespeak.net mwh at codespeak.net
Fri May 30 18:27:37 CEST 2003


Author: mwh
Date: Fri May 30 18:27:36 2003
New Revision: 737

Modified:
   pypy/trunk/src/pypy/objspace/std/default.py
   pypy/trunk/src/pypy/objspace/std/stringobject.py
Log:
add default_str which calls the also added default_repr
add a bogus str_repr


Modified: pypy/trunk/src/pypy/objspace/std/default.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/default.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/default.py	Fri May 30 18:27:36 2003
@@ -136,3 +136,14 @@
         return w_type
 
 StdObjSpace.type.register(default_type, W_ANY)
+
+def default_str(space, w_obj):
+    return space.repr(w_obj)
+
+StdObjSpace.str.register(default_str, W_ANY)
+
+def default_repr(space, w_obj):
+    return space.wrap('<%s object at %s>'%(
+        space.type(w_obj).typename, space.unwrap(space.id(w_obj))))
+
+StdObjSpace.repr.register(default_repr, W_ANY)

Modified: pypy/trunk/src/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/stringobject.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/stringobject.py	Fri May 30 18:27:36 2003
@@ -317,3 +317,11 @@
     return w_str
 
 StdObjSpace.str.register(str_str, W_StringObject)
+
+def str_repr(space, w_str):
+    # XXX this is bogus -- mwh
+    a = space.add
+    q = space.wrap("'")
+    return a(a(q, w_str), q)
+
+StdObjSpace.repr.register(str_repr, W_StringObject)


More information about the Pypy-commit mailing list