[pypy-commit] pypy dynamic-specialized-tuple: stuff all works.

alex_gaynor noreply at buildbot.pypy.org
Tue Mar 13 09:07:38 CET 2012


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: dynamic-specialized-tuple
Changeset: r53432:f94b53cdbc77
Date: 2012-03-13 00:12 -0700
http://bitbucket.org/pypy/pypy/changeset/f94b53cdbc77/

Log:	stuff all works.

diff --git a/pypy/objspace/std/test/test_tupleobject.py b/pypy/objspace/std/test/test_tupleobject.py
--- a/pypy/objspace/std/test/test_tupleobject.py
+++ b/pypy/objspace/std/test/test_tupleobject.py
@@ -49,6 +49,7 @@
         assert () * 10 == ()
         assert (5,) * 3 == (5,5,5)
         assert (5,2) * 2 == (5,2,5,2)
+        assert 2 * (5,) == (5, 5)
 
     def test_mul_identity(self):
         t = (1,2,3)
@@ -123,7 +124,10 @@
     def setup_class(cls):
         def w_get_specializion(space, w_tuple):
             return space.wrap(w_tuple.storage.getshape())
+        def w_same_specialization(space, w_tuple1, w_tuple2):
+            return space.wrap(w_tuple1.storage.getshape() is w_tuple2.storage.getshape())
         cls.w_get_specialization = cls.space.wrap(interp2app(w_get_specializion))
+        cls.w_same_specialization = cls.space.wrap(interp2app(w_same_specialization))
 
     def test_ints(self):
         t = (1, 2, 3)
@@ -177,6 +181,3 @@
         t *= 2
         assert self.same_specialization(s, t)
 
-        t = (1,) * 10
-        s = (1,) * 9
-        assert self.same_specialization(s, t)
diff --git a/pypy/objspace/std/tupleobject.py b/pypy/objspace/std/tupleobject.py
--- a/pypy/objspace/std/tupleobject.py
+++ b/pypy/objspace/std/tupleobject.py
@@ -98,7 +98,7 @@
     return space.newtuple(w_tuple.tolist(space) * times)
 
 def mul__ANY_Tuple(space, w_times, w_tuple):
-    pass
+    return mul__Tuple_ANY(space, w_tuple, w_times)
 
 def eq__Tuple_Tuple(space, w_tuple1, w_tuple2):
     if w_tuple1.storage.getshape() is not w_tuple2.storage.getshape():


More information about the pypy-commit mailing list