[pypy-commit] pypy SpecialisedTuples: (mwp) create Classes for float-float and str-str specialisations

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


Author: Mark Pearse <mark.pearse at skynet.be>
Branch: SpecialisedTuples
Changeset: r49098:d693552c9046
Date: 2011-11-06 11:30 +0100
http://bitbucket.org/pypy/pypy/changeset/d693552c9046/

Log:	(mwp) create Classes for float-float and str-str specialisations

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
@@ -23,6 +23,14 @@
                 val0 = space.int_w(w_item0)
                 val1 = space.int_w(w_item1)
                 return W_SpecialisedTupleObjectIntInt(space, val0, val1)
+        if space.type(w_item0) == space.w_float and space.type(w_item1) == space.w_float:
+                val0 = space.float_w(w_item0)
+                val1 = space.float_w(w_item1)
+                return W_SpecialisedTupleObjectFloatFloat(space, val0, val1)
+        if space.type(w_item0) == space.w_str and space.type(w_item1) == space.w_str:
+                val0 = space.str_w(w_item0)
+                val1 = space.str_w(w_item1)
+                return W_SpecialisedTupleObjectStrStr(space, val0, val1)
     raise NotSpecialised                        
 
 class W_SpecialisedTupleObject(W_Object):
@@ -98,8 +106,10 @@
     return cls
     
     
-W_SpecialisedTupleObjectIntInt = make_specialised_class('W_SpecialisedTupleObjectIntInt', int,int)
-    
+W_SpecialisedTupleObjectIntInt     = make_specialised_class('W_SpecialisedTupleObjectIntInt',     int,int)
+W_SpecialisedTupleObjectFloatFloat = make_specialised_class('W_SpecialisedTupleObjectFloatFloat', float,float)
+W_SpecialisedTupleObjectStrStr     = make_specialised_class('W_SpecialisedTupleObjectStrStr',     str, str)
+
 registerimplementation(W_SpecialisedTupleObject)
 
 def delegate_SpecialisedTuple2Tuple(space, w_specialised):


More information about the pypy-commit mailing list