summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-02-25 22:53:08 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-02-25 23:05:20 +0100
commite76147a83a7306d6d83057b982207ddab37eb942 (patch)
tree76208c6cd41b050c119c733bbce3f5541c66d8e0 /django/utils
parent0836670c5cd8bb17322504c46e07d3944add63c3 (diff)
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.
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/functional.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/utils/functional.py b/django/utils/functional.py
index 51001ea655..69a32b101a 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -152,7 +152,8 @@ def lazy(func, *resultclasses):
other = other.__cast()
return self.__cast() < other
- __hash__ = object.__hash__
+ def __hash__(self):
+ return hash(self.__cast())
def __mod__(self, rhs):
if self._delegate_bytes and not six.PY3: