[pypy-svn] r68763 - in pypy/branch/shrink-multidict/pypy/interpreter: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Oct 26 18:42:39 CET 2009


Author: cfbolz
Date: Mon Oct 26 18:42:39 2009
New Revision: 68763

Modified:
   pypy/branch/shrink-multidict/pypy/interpreter/function.py
   pypy/branch/shrink-multidict/pypy/interpreter/test/test_function.py
Log:
the repr of bound methods was wrong (and quite confusing)


Modified: pypy/branch/shrink-multidict/pypy/interpreter/function.py
==============================================================================
--- pypy/branch/shrink-multidict/pypy/interpreter/function.py	(original)
+++ pypy/branch/shrink-multidict/pypy/interpreter/function.py	Mon Oct 26 18:42:39 2009
@@ -478,9 +478,8 @@
             return space.wrap(s)
         else:
             objrepr = space.str_w(space.repr(self.w_instance))
-            info = 'bound method %s.%s of %s' % (typename, name, objrepr)
-            # info = "method %s of %s object" % (name, typename)
-            return self.w_instance.getrepr(self.space, info)
+            s = '<bound method %s.%s of %s>' % (typename, name, objrepr)
+            return space.wrap(s)
 
     def descr_method_getattribute(self, w_attr):
         space = self.space

Modified: pypy/branch/shrink-multidict/pypy/interpreter/test/test_function.py
==============================================================================
--- pypy/branch/shrink-multidict/pypy/interpreter/test/test_function.py	(original)
+++ pypy/branch/shrink-multidict/pypy/interpreter/test/test_function.py	Mon Oct 26 18:42:39 2009
@@ -346,11 +346,13 @@
                 pass
         assert repr(A.f) == "<unbound method A.f>"
         assert repr(A().f).startswith("<bound method A.f of <") 
+        assert repr(A().f).endswith(">>") 
         class B:
             def f(self):
                 pass
         assert repr(B.f) == "<unbound method B.f>"
         assert repr(B().f).startswith("<bound method B.f of <")
+        assert repr(A().f).endswith(">>") 
 
 
     def test_method_call(self):



More information about the Pypy-commit mailing list