Author: Manuel Jacob
Branch: remove-list-smm-2
Changeset: r64190:023fdccdedde
Date: 2013-05-15 18:22 +0200
http://bitbucket.org/pypy/pypy/changeset/023fdccdedde/

Log:    Remove list.__repr__ multi-method.

diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -342,6 +342,15 @@
         if w_iterable is not None:
             self.extend(w_iterable)
 
+    def descr_repr(self, space):
+        if self.length() == 0:
+            return space.wrap('[]')
+        ec = space.getexecutioncontext()
+        w_currently_in_repr = ec._py_repr
+        if w_currently_in_repr is None:
+            w_currently_in_repr = ec._py_repr = space.newdict()
+        return listrepr(space, w_currently_in_repr, self)
+
     @jit.look_inside_iff(list_unroll_condition)
     def descr_eq(self, space, w_other):
         if not isinstance(w_other, W_ListObject):
@@ -1579,15 +1588,6 @@
 
 listrepr = app.interphook("listrepr")
 
-def repr__List(space, w_list):
-    if w_list.length() == 0:
-        return space.wrap('[]')
-    ec = space.getexecutioncontext()
-    w_currently_in_repr = ec._py_repr
-    if w_currently_in_repr is None:
-        w_currently_in_repr = ec._py_repr = space.newdict()
-    return listrepr(space, w_currently_in_repr, w_list)
-
 def get_positive_index(where, length):
     if where < 0:
         where += length
@@ -1688,6 +1688,7 @@
 list(sequence) -> new list initialized from sequence's items""",
     __new__ = interp2app(descr_new),
     __init__ = interp2app(W_ListObject.descr_init),
+    __repr__ = interp2app(W_ListObject.descr_repr),
     __hash__ = None,
 
     __eq__ = interp2app(W_ListObject.descr_eq),
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to