Skip to content

Commit fce43ce

Browse files
committed
[hotfix] Set.remove
PullRequest: graalpython-open/46
2 parents c4b594f + 9efbf67 commit fce43ce

File tree

2 files changed

+8
-1
lines changed
  • graalpython
    • com.oracle.graal.python.test/src/tests
    • com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/set

2 files changed

+8
-1
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_set.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,10 @@ def test_set_or():
5353

5454
union = s1 | s4
5555
assert union == {1, 2, 3}
56+
57+
58+
def test_set_remove():
59+
s = {1, 2, 3}
60+
assert s == {1, 2, 3}
61+
s.remove(3)
62+
assert s == {1, 2}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/set/SetBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ abstract static class RemoveNode extends PythonBinaryBuiltinNode {
103103
Object remove(PBaseSet self, Object other,
104104
@Cached("create()") HashingStorageNodes.DelItemNode delItemNode) {
105105

106-
if (delItemNode.execute(self, self.getDictStorage(), other)) {
106+
if (!delItemNode.execute(self, self.getDictStorage(), other)) {
107107
throw raise(PythonErrorType.KeyError, "%s", other);
108108
}
109109
return PNone.NONE;

0 commit comments

Comments
 (0)