[pypy-commit] pypy dynamic-specialized-tuple: (alex, fijal) fix obsure stuff
alex_gaynor
noreply at buildbot.pypy.org
Tue Mar 13 09:15:31 CET 2012
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: dynamic-specialized-tuple
Changeset: r53434:13c9f09eac50
Date: 2012-03-13 00:30 -0700
http://bitbucket.org/pypy/pypy/changeset/13c9f09eac50/
Log: (alex, fijal) fix obsure stuff
diff --git a/pypy/module/cpyext/setobject.py b/pypy/module/cpyext/setobject.py
--- a/pypy/module/cpyext/setobject.py
+++ b/pypy/module/cpyext/setobject.py
@@ -6,7 +6,6 @@
borrow_from, make_ref, from_ref)
from pypy.module.cpyext.pyerrors import PyErr_BadInternalCall
from pypy.objspace.std.setobject import W_SetObject, newset
-from pypy.objspace.std.smalltupleobject import W_SmallTupleObject
PySet_Check, PySet_CheckExact = build_type_checkers("Set")
diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -1046,7 +1046,7 @@
if isinstance(w_iterable, W_ListObject):
w_list.extend(w_iterable)
elif isinstance(w_iterable, W_TupleObject):
- w_list.extend(W_ListObject(space, w_iterable.wrappeditems[:]))
+ w_list.extend(W_ListObject(space, w_iterable.tolist(space)))
else:
_init_from_iterable(space, w_list, w_iterable)
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -432,7 +432,7 @@
if isinstance(w_obj, W_ListObject):
t = w_obj.getitems()
elif isinstance(w_obj, W_AbstractTupleObject):
- t = w_obj.getitems_copy()
+ t = w_obj.getitems_copy(self)
else:
return ObjSpace.unpackiterable(self, w_obj, expected_length)
if expected_length != -1 and len(t) != expected_length:
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
@@ -123,9 +123,9 @@
class AppTest_SpecializedTuple(object):
def setup_class(cls):
def w_get_specializion(space, w_tuple):
- return space.wrap(w_tuple.storage.getshape())
+ return space.wrap(w_tuple.tuplestorage.getshape())
def w_same_specialization(space, w_tuple1, w_tuple2):
- return space.wrap(w_tuple1.storage.getshape() is w_tuple2.storage.getshape())
+ return space.wrap(w_tuple1.tuplestorage.getshape() is w_tuple2.tuplestorage.getshape())
cls.w_get_specialization = cls.space.wrap(interp2app(w_get_specializion))
cls.w_same_specialization = cls.space.wrap(interp2app(w_same_specialization))
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
@@ -14,6 +14,10 @@
class W_AbstractTupleObject(W_Object):
__slots__ = ()
+ def unwrap(self, space):
+ items = [space.unwrap(w_item) for w_item in self.tolist(space)]
+ return tuple(items)
+
def tolist(self, space):
"Returns the items, as a fixed-size list."
raise NotImplementedError
@@ -25,8 +29,8 @@
class W_TupleObject(W_AbstractTupleObject):
from pypy.objspace.std.tupletype import tuple_typedef as typedef
- def __init__(self, storage):
- self.storage = storage
+ def __init__(self, tuplestorage):
+ self.tuplestorage = tuplestorage
def tolist(self, space):
items_w = [None] * self.length()
@@ -38,12 +42,12 @@
return self.tolist(space)
def length(self):
- return self.storage.getlength()
+ return self.tuplestorage.getlength()
def getitem(self, space, i):
from pypy.objspace.std.tupletype import read_obj
- return read_obj(space, self.storage, i)
+ return read_obj(space, self.tuplestorage, i)
registerimplementation(W_TupleObject)
@@ -101,7 +105,7 @@
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():
+ if w_tuple1.tuplestorage.getshape() is not w_tuple2.tuplestorage.getshape():
return space.w_False
if w_tuple1.length() != w_tuple2.length():
return space.w_False
More information about the pypy-commit
mailing list