Author: Lukas Diekmann <[email protected]>
Branch: 
Changeset: r44426:3b8838b02d10
Date: 2011-01-18 15:14 +0100
http://bitbucket.org/pypy/pypy/changeset/3b8838b02d10/

Log:    (l.diekmann, cfbolz): Fixed W_TupleObject to go via space.newtuple

diff --git a/pypy/objspace/std/test/test_smalltupleobject.py 
b/pypy/objspace/std/test/test_smalltupleobject.py
--- a/pypy/objspace/std/test/test_smalltupleobject.py
+++ b/pypy/objspace/std/test/test_smalltupleobject.py
@@ -14,10 +14,16 @@
             return issmall
         """)
 
-    def test_slicing_small(self):
+    def test_slicing_to_small(self):
         self.issmall((1, 2, 3)[0:2])
         self.issmall((1, 2, 3)[0:2:1])
 
+    def test_adding_to_small(self):
+        self.issmall((1,)+(2,))
+
+    def test_multiply_to_small(self):
+        self.issmall((1,)*2)
+
 class TestW_SmallTupleObject():
 
     def setup_class(cls):
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
@@ -76,7 +76,7 @@
 def add__Tuple_Tuple(space, w_tuple1, w_tuple2):
     items1 = w_tuple1.wrappeditems
     items2 = w_tuple2.wrappeditems
-    return W_TupleObject(items1 + items2)
+    return space.newtuple(items1 + items2)
 
 def mul_tuple_times(space, w_tuple, w_times):
     try:
@@ -88,7 +88,7 @@
     if times == 1 and space.type(w_tuple) == space.w_tuple:
         return w_tuple
     items = w_tuple.wrappeditems
-    return W_TupleObject(items * times)    
+    return space.newtuple(items * times)
 
 def mul__Tuple_ANY(space, w_tuple, w_times):
     return mul_tuple_times(space, w_tuple, w_times)
@@ -159,7 +159,7 @@
     return space.wrap(intmask(x))
 
 def getnewargs__Tuple(space, w_tuple):
-    return space.newtuple([W_TupleObject(w_tuple.wrappeditems)])
+    return space.newtuple([space.newtuple(w_tuple.wrappeditems)])
 
 def tuple_count__Tuple_ANY(space, w_tuple, w_obj):
     count = 0
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to