Skip to content

Commit 7d70459

Browse files
committed
Ignore object.__hash__ as we do everywhere else
1 parent c544e98 commit 7d70459

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mypy/plugins/dataclasses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ def _add_dunder_hash(self, is_hashable: bool) -> None:
467467
else:
468468
# Python sets `__hash__ = None` otherwise, do the same.
469469
parent_method = self._cls.info.get_method("__hash__")
470-
if parent_method is not None:
471-
# If we inherited `__hash__`, ensure it isn't overridden
470+
if parent_method is not None and parent_method.info.fullname != "builtins.object":
471+
# If we inherited `__hash__` not from `object`, ensure it isn't overridden
472472
self._api.fail(
473473
"Incompatible override of '__hash__': dataclasses without"
474474
" 'frozen' or 'unsafe_hash' have '__hash__' set to None",

0 commit comments

Comments
 (0)