8000 [Set] Raise `KeyError` if elem not contained in the set (#152903) · pytorch/pytorch@5c6830c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c6830c

Browse files
guilhermeleobaspytorchmergebot
authored andcommitted
[Set] Raise KeyError if elem not contained in the set (#152903)
Pull Request resolved: #152903 Approved by: https://github.com/anijain2305 ghstack dependencies: #150792, #152987, #152988, #152904, #152901, #152902
1 parent 574f4c5 commit 5c6830c

File tree

3 files changed

+1
-1
lines changed

3 files changed

+1
-1
lines changed

test/dynamo_expected_failures/CPython313-test_set-TestMutate.test_remove_absent

Whitespace-only changes.

test/dynamo_expected_failures/CPython313-test_set-TestSet.test_remove_keyerror_set

Whitespace-only changes.

torch/_dynamo/variables/dicts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ def call_method(
816816
assert not kwargs
817817
assert len(args) == 1
818818
if args[0] not in self:
819-
unimplemented("key does not exist")
819+
raise_observed_exception(KeyError, tx, args=args)
820820
return super().call_method(tx, "pop", args, kwargs)
821821
elif name == "discard":
822822
assert not kwargs

0 commit comments

Comments
 (0)
0