Esempio n. 1
0
def descr__frozenset__new__(space, w_frozensettype, w_iterable=None):
    from pypy.objspace.std.setobject import W_FrozensetObject
    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
    w_obj = space.allocate_instance(W_FrozensetObject, w_frozensettype)
    W_FrozensetObject.__init__(w_obj, space, w_iterable)
    return w_obj
Esempio n. 2
0
def descr__frozenset__new__(space, w_frozensettype, w_iterable=NoneNotWrapped):
    from pypy.objspace.std.setobject import W_FrozensetObject
    from pypy.objspace.std.setobject import _is_frozenset_exact
    if _is_frozenset_exact(w_iterable):
        return w_iterable
    w_obj = space.allocate_instance(W_FrozensetObject, w_frozensettype)
    W_FrozensetObject.__init__(w_obj, space, None)

    return w_obj
Esempio n. 3
0
def descr__frozenset__new__(space, w_frozensettype, w_iterable=NoneNotWrapped):
    from pypy.objspace.std.setobject import W_FrozensetObject
    from pypy.objspace.std.setobject import _is_frozenset_exact
    if _is_frozenset_exact(w_iterable):
        return w_iterable
    w_obj = space.allocate_instance(W_FrozensetObject, w_frozensettype)
    W_FrozensetObject.__init__(w_obj, space, None)

    return w_obj
Esempio n. 4
0
def descr__frozenset__new__(space, w_frozensettype, w_iterable=None):
    from pypy.objspace.std.setobject import W_FrozensetObject
    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
    w_obj = space.allocate_instance(W_FrozensetObject, w_frozensettype)
    W_FrozensetObject.__init__(w_obj, space, w_iterable)
    return w_obj
Esempio n. 5
0
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
    w_obj = space.allocate_instance(W_FrozensetObject, w_frozensettype)
    data = make_setdata_from_w_iterable(space, w_iterable)
    W_FrozensetObject.__init__(w_obj, space, data)
    return w_obj
Esempio n. 6
0
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
    w_obj = space.allocate_instance(W_FrozensetObject, w_frozensettype)
    data = make_setdata_from_w_iterable(space, w_iterable)
    W_FrozensetObject.__init__(w_obj, space, data)
    return w_obj