-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcomeruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
with v0.3.4, ruff check t.py --select PLW1641 on
class A:
def __eq__(self, other):
return False
def __hash__(self):
return 7
class B(A):
def __eq__(self, other):
return True
__hash__ = A.__hash__issues
PLW1641 Object does not implement `__hash__` method
|
12 | class B(A):
| ^ PLW1641
13 | def __eq__(self, other):
14 | return Trueeven though the docs explicitly recommend this:
If a class that overrides eq() needs to retain the implementation of hash() from a parent class, the interpreter must be told this explicitly by setting
__hash__ = <ParentClass>.__hash__.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcomeruleImplementing or modifying a lint ruleImplementing or modifying a lint rule