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:
Aymeric Augustin 2013-02-25 22:53:08 +01:00
parent 0836670c5c
commit e76147a83a
7 changed files with 24 additions and 16 deletions

View file

@ -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: