Skip to content

Commit ec93414

Browse files
[dict] Implement __eq__ for dict_items
ghstack-source-id: cb4cef8 Pull Request resolved: #155154
1 parent 61164e4 commit ec93414

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

test/dynamo_expected_failures/CPython313-test_ordered_dict-CPythonOrderedDictTests.test_views

Whitespace-only changes.

torch/_dynamo/variables/dicts.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,3 +1215,11 @@ def view_items_vt(self):
12151215

12161216
def python_type(self):
12171217
return dict_items
1218+
1219+
def call_method(self, tx, name, args, kwargs):
1220+
if name == "__eq__":
1221+
assert len(args) == 1
1222+
if isinstance(args[0], DictItemsVariable):
1223+
return self.dv_dict.call_method(tx, "__eq__", [args[0].dv_dict], {})
1224+
return ConstantVariable.create(False)
1225+
return super().call_method(tx, name, args, kwargs)

0 commit comments

Comments
 (0)