mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #19634 -- Added proper __hash__ methods.
Classes overriding __eq__ need a __hash__ such that equal objects have the same hash. Thanks akaariai for the report and regebro for the patch.
This commit is contained in:
@@ -152,7 +152,8 @@ class BoundMethodWeakref(object):
|
||||
|
||||
__repr__ = __str__
|
||||
|
||||
__hash__ = object.__hash__
|
||||
def __hash__(self):
|
||||
return hash(self.key)
|
||||
|
||||
def __bool__( self ):
|
||||
"""Whether we are still a valid reference"""
|
||||
|
||||
Reference in New Issue
Block a user