Author: Lukas Diekmann <lukas.diekm...@uni-duesseldorf.de> Branch: set-strategies Changeset: r49194:6a2ef1ad6abe Date: 2011-07-28 11:41 +0200 http://bitbucket.org/pypy/pypy/changeset/6a2ef1ad6abe/
Log: make_setdata_from_w_iterable is not needed anymore diff --git a/pypy/objspace/std/frozensettype.py b/pypy/objspace/std/frozensettype.py --- a/pypy/objspace/std/frozensettype.py +++ b/pypy/objspace/std/frozensettype.py @@ -39,7 +39,6 @@ def descr__frozenset__new__(space, w_frozensettype, w_iterable=gateway.NoneNotWrapped): from pypy.objspace.std.setobject import W_FrozensetObject - from pypy.objspace.std.setobject import make_setdata_from_w_iterable if (space.is_w(w_frozensettype, space.w_frozenset) and w_iterable is not None and type(w_iterable) is W_FrozensetObject): return w_iterable diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py --- a/pypy/objspace/std/setobject.py +++ b/pypy/objspace/std/setobject.py @@ -725,6 +725,7 @@ for item_w in w_iterable: if type(item_w) is not W_IntObject: break; + #XXX wont work for [1, "two", "three", 1] use StopIteration instead if item_w is w_iterable[-1]: w_set.strategy = space.fromcache(IntegerSetStrategy) w_set.sstorage = w_set.strategy.get_storage_from_list(w_iterable) @@ -733,18 +734,6 @@ w_set.strategy = space.fromcache(ObjectSetStrategy) w_set.sstorage = w_set.strategy.get_storage_from_list(w_iterable) -def make_setdata_from_w_iterable(space, w_iterable=None): - #XXX remove this later - """Return a new r_dict with the content of w_iterable.""" - if isinstance(w_iterable, W_BaseSetObject): - #XXX is this bad or not? - return w_iterable.getdict_w() - data = newset(space) - if w_iterable is not None: - for w_item in space.listview(w_iterable): - data[w_item] = None - return data - def _initialize_set(space, w_obj, w_iterable=None): w_obj.clear() set_strategy_and_setdata(space, w_obj, w_iterable) @@ -1087,6 +1076,7 @@ def set_isdisjoint__Set_ANY(space, w_left, w_other): #XXX maybe checking if type fits strategy first (before comparing) speeds this up a bit # since this will be used in many other functions -> general function for that + # if w_left.strategy != w_other.strategy => return w_False for w_key in space.listview(w_other): if w_left.has_key(w_key): return space.w_False diff --git a/pypy/objspace/std/test/test_setobject.py b/pypy/objspace/std/test/test_setobject.py --- a/pypy/objspace/std/test/test_setobject.py +++ b/pypy/objspace/std/test/test_setobject.py @@ -18,13 +18,6 @@ letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' -def make_setdata_from_w_iterable(space, w_iterable): - data = newset(space) - if w_iterable is not None: - for w_item in space.listview(w_iterable): - data[w_item] = None - return data - class W_SubSetObject(W_SetObject):pass class TestW_SetObject: _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit