File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
com.oracle.graal.python.test/src/tests
com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/set Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 40
40
# ankitv 10/10/13
41
41
# Iterating by Sequence Index
42
42
43
+ from collections .abc import MutableSet
43
44
44
45
def assert_raises (err , fn , * args , ** kwargs ):
45
46
raised = False
@@ -315,6 +316,12 @@ def test_same_id():
315
316
empty_ids = set ([id (frozenset ()) for i in range (100 )])
316
317
assert len (empty_ids ) == 1
317
318
319
+ def test_init ():
320
+ s = {1 , 2 , 3 }
321
+ s .__init__ ({4 })
322
+ assert s == {4 }
323
+ s .__init__ ()
324
+ assert s == set ()
318
325
319
326
def test_rich_compare ():
320
327
class TestRichSetCompare :
Original file line number Diff line number Diff line change @@ -86,9 +86,11 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa
86
86
@ ImportStatic (PGuards .class )
87
87
public abstract static class InitNode extends PythonBuiltinNode {
88
88
89
- @ Specialization (guards = "isNoValue(iterable)" )
90
- @ SuppressWarnings ("unused" )
91
- static PNone doNoValue (VirtualFrame frame , PSet self , PNone iterable ) {
89
+ @ Specialization (guards = "isNoValue(iterable)" , limit = "1" )
90
+ static PNone doNoValue (PSet self , @ SuppressWarnings ("unused" ) PNone iterable ,
91
+ @ CachedLibrary ("self.getDictStorage()" ) HashingStorageLibrary lib ) {
92
+ HashingStorage newStorage = lib .clear (self .getDictStorage ());
93
+ self .setDictStorage (newStorage );
92
94
return PNone .NONE ;
93
95
}
94
96
You can’t perform that action at this time.
0 commit comments