Commit 97adf070 authored by Robert Bradshaw's avatar Robert Bradshaw

Disable set.update() optimization due to Python incompatibility.

set.update() is actually variadic.  Fixes #1645.
parent d1306d23
...@@ -319,8 +319,9 @@ builtin_types_table = [ ...@@ -319,8 +319,9 @@ builtin_types_table = [
BuiltinMethod("clear", "T", "r", "PySet_Clear"), BuiltinMethod("clear", "T", "r", "PySet_Clear"),
# discard() and remove() have a special treatment for unhashable values # discard() and remove() have a special treatment for unhashable values
# BuiltinMethod("discard", "TO", "r", "PySet_Discard"), # BuiltinMethod("discard", "TO", "r", "PySet_Discard"),
BuiltinMethod("update", "TO", "r", "__Pyx_PySet_Update", # update is actually variadic (see Github issue #1645)
utility_code=UtilityCode.load_cached("PySet_Update", "Builtins.c")), # BuiltinMethod("update", "TO", "r", "__Pyx_PySet_Update",
# utility_code=UtilityCode.load_cached("PySet_Update", "Builtins.c")),
BuiltinMethod("add", "TO", "r", "PySet_Add"), BuiltinMethod("add", "TO", "r", "PySet_Add"),
BuiltinMethod("pop", "T", "O", "PySet_Pop")]), BuiltinMethod("pop", "T", "O", "PySet_Pop")]),
("frozenset", "PyFrozenSet_Type", []), ("frozenset", "PyFrozenSet_Type", []),
......
...@@ -88,6 +88,18 @@ def test_set_update(v=None): ...@@ -88,6 +88,18 @@ def test_set_update(v=None):
return s1 return s1
def test_set_multi_update(a, b, c):
"""
>>> type(test_set_multi_update()) is set
True
>>> sorted(test_set_multi_update())
"""
['a', 'b', 'c', 1, 2, (1, 2)]
cdef set s1 = set()
s1.update('abc', set([1]), frozenset((1,2)))
return s1
def test_object_update(v=None): def test_object_update(v=None):
""" """
>>> type(test_object_update()) is set >>> type(test_object_update()) is set
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment