Author: Lukas Diekmann <[email protected]>
Branch:
Changeset: r44432:442cdda5a8a4
Date: 2011-01-26 11:15 +0100
http://bitbucket.org/pypy/pypy/changeset/442cdda5a8a4/
Log: Added more specialized SmallTupleObjects
diff --git a/pypy/objspace/std/smalltupleobject.py
b/pypy/objspace/std/smalltupleobject.py
--- a/pypy/objspace/std/smalltupleobject.py
+++ b/pypy/objspace/std/smalltupleobject.py
@@ -49,6 +49,11 @@
W_SmallTupleObject2 = make_specialized_class(2)
W_SmallTupleObject3 = make_specialized_class(3)
+W_SmallTupleObject4 = make_specialized_class(4)
+W_SmallTupleObject5 = make_specialized_class(5)
+W_SmallTupleObject6 = make_specialized_class(6)
+W_SmallTupleObject7 = make_specialized_class(7)
+W_SmallTupleObject8 = make_specialized_class(8)
registerimplementation(W_SmallTupleObject)
diff --git a/pypy/objspace/std/tupletype.py b/pypy/objspace/std/tupletype.py
--- a/pypy/objspace/std/tupletype.py
+++ b/pypy/objspace/std/tupletype.py
@@ -5,12 +5,28 @@
def wraptuple(space, list_w):
from pypy.objspace.std.tupleobject import W_TupleObject
- from pypy.objspace.std.smalltupleobject import W_SmallTupleObject2,
W_SmallTupleObject3
+ from pypy.objspace.std.smalltupleobject import W_SmallTupleObject2
+ from pypy.objspace.std.smalltupleobject import W_SmallTupleObject3
+ from pypy.objspace.std.smalltupleobject import W_SmallTupleObject4
+ from pypy.objspace.std.smalltupleobject import W_SmallTupleObject5
+ from pypy.objspace.std.smalltupleobject import W_SmallTupleObject6
+ from pypy.objspace.std.smalltupleobject import W_SmallTupleObject7
+ from pypy.objspace.std.smalltupleobject import W_SmallTupleObject8
if space.config.objspace.std.withsmalltuple:
if len(list_w) == 2:
return W_SmallTupleObject2(list_w)
if len(list_w) == 3:
return W_SmallTupleObject3(list_w)
+ if len(list_w) == 4:
+ return W_SmallTupleObject4(list_w)
+ if len(list_w) == 5:
+ return W_SmallTupleObject5(list_w)
+ if len(list_w) == 6:
+ return W_SmallTupleObject6(list_w)
+ if len(list_w) == 7:
+ return W_SmallTupleObject7(list_w)
+ if len(list_w) == 8:
+ return W_SmallTupleObject8(list_w)
return W_TupleObject(list_w)
tuple_count = SMM("count", 2,
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit