[pypy-commit] pypy SpecialisedTuples: (antocuni, mwp) improve eq test and kill commented code

mwp noreply at buildbot.pypy.org
Thu Nov 10 10:47:37 CET 2011


Author: Mark Pearse <mark.pearse at skynet.be>
Branch: SpecialisedTuples
Changeset: r49092:22205add64b8
Date: 2011-11-05 17:45 +0100
http://bitbucket.org/pypy/pypy/changeset/22205add64b8/

Log:	(antocuni, mwp) improve eq test and kill commented code

diff --git a/pypy/objspace/std/specialisedtupleobject.py b/pypy/objspace/std/specialisedtupleobject.py
--- a/pypy/objspace/std/specialisedtupleobject.py
+++ b/pypy/objspace/std/specialisedtupleobject.py
@@ -111,35 +111,7 @@
     except IndexError:
         raise OperationError(space.w_IndexError,
                              space.wrap("tuple index out of range"))
-'''
-def getitem__SpecialisedTuple_Slice(space, w_tuple, w_slice):
-    length = w_tuple.length()
-    start, stop, step, slicelength = w_slice.indices4(space, length)
-    assert slicelength >= 0
-    subitems = [None] * slicelength
-    for i in range(slicelength):
-        subitems[i] = w_tuple.getitem(start)
-        start += step
-    return space.newtuple(subitems)
 
-def mul_specialisedtuple_times(space, w_tuple, w_times):
-    try:
-        times = space.getindex_w(w_times, space.w_OverflowError)
-    except OperationError, e:
-        if e.match(space, space.w_TypeError):
-            raise FailedToImplement
-        raise
-    if times == 1 and space.type(w_tuple) == space.w_tuple:
-        return w_tuple
-    items = w_tuple.tolist()
-    return space.newtuple(items * times)
-
-def mul__SpecialisedTuple_ANY(space, w_tuple, w_times):
-    return mul_specialisedtuple_times(space, w_tuple, w_times)
-
-def mul__ANY_SpecialisedTuple(space, w_times, w_tuple):
-    return mul_specialisedtuple_times(space, w_tuple, w_times)
-'''
 def eq__SpecialisedTuple_SpecialisedTuple(space, w_tuple1, w_tuple2):
     return w_tuple1.eq(space, w_tuple2)
 
diff --git a/pypy/objspace/std/test/test_specialisedtupleobject.py b/pypy/objspace/std/test/test_specialisedtupleobject.py
--- a/pypy/objspace/std/test/test_specialisedtupleobject.py
+++ b/pypy/objspace/std/test/test_specialisedtupleobject.py
@@ -88,6 +88,9 @@
         b = (1,2)
         assert a == b
         
+        c = (2,1)
+        assert not a == c
+        
     def test_eq_can_delegate(self):        
         a = (1,2)
         b = (1,3,2)


More information about the pypy-commit mailing list