[pypy-commit] pypy py3k: add a repr similar to cpython

antocuni noreply at buildbot.pypy.org
Wed Mar 21 11:24:30 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r53853:1064b91af6cd
Date: 2012-03-21 11:18 +0100
http://bitbucket.org/pypy/pypy/changeset/1064b91af6cd/

Log:	add a repr similar to cpython

diff --git a/pypy/module/__builtin__/interp_memoryview.py b/pypy/module/__builtin__/interp_memoryview.py
--- a/pypy/module/__builtin__/interp_memoryview.py
+++ b/pypy/module/__builtin__/interp_memoryview.py
@@ -118,6 +118,9 @@
         # I've never seen anyone filling this field
         return space.w_None
 
+    def descr_repr(self, space):
+        return self.getrepr(space, 'memory')
+
 
 def descr_new(space, w_subtype, w_object):
     memoryview = W_MemoryView(space.buffer(w_object))
@@ -139,6 +142,7 @@
     __lt__      = interp2app(W_MemoryView.descr_lt),
     __ne__      = interp2app(W_MemoryView.descr_ne),
     __setitem__ = interp2app(W_MemoryView.descr_setitem),
+    __repr__    = interp2app(W_MemoryView.descr_repr),
     tobytes     = interp2app(W_MemoryView.descr_tobytes),
     tolist      = interp2app(W_MemoryView.descr_tolist),
     format      = GetSetProperty(W_MemoryView.w_get_format),


More information about the pypy-commit mailing list