Skip to content

Commit dc8f9ea

Browse files
[dict] Implement __eq__ for dict_items
ghstack-source-id: 6ee643c Pull Request resolved: #155154
1 parent 39aeda8 commit dc8f9ea

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
@@ -1211,3 +1211,11 @@ def view_items_vt(self):
12111211

12121212
def python_type(self):
12131213
return dict_items
1214+
1215+
def call_method(self, tx, name, args, kwargs):
1216+
if name == "__eq__":
1217+
assert len(args) == 1
1218+
if isinstance(args[0], DictItemsVariable):
1219+
return self.dv_dict.call_method(tx, "__eq__", [args[0].dv_dict], {})
1220+
return ConstantVariable.create(False)
1221+
return super().call_method(tx, name, args, kwargs)

0 commit comments

Comments
 (0)