We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c544e98 commit 7d70459Copy full SHA for 7d70459
mypy/plugins/dataclasses.py
@@ -467,8 +467,8 @@ def _add_dunder_hash(self, is_hashable: bool) -> None:
467
else:
468
# Python sets `__hash__ = None` otherwise, do the same.
469
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
+ if parent_method is not None and parent_method.info.fullname != "builtins.object":
+ # If we inherited `__hash__` not from `object`, ensure it isn't overridden
472
self._api.fail(
473
"Incompatible override of '__hash__': dataclasses without"
474
" 'frozen' or 'unsafe_hash' have '__hash__' set to None",
0 commit comments