Ticket #19634: #19634-broken_hash_methods.diff

File #19634-broken_hash_methods.diff, 2.3 KB (added by regebro, 12 years ago)
  • django/db/backends/__init__.py

    diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
    index 958982b..18764b8 100644
    a b class BaseDatabaseWrapper(object):  
    5151    def __ne__(self, other):
    5252        return not self == other
    5353
     54    # You can have several connections with the same parameters,
     55    # and they should not have the same hash.
    5456    __hash__ = object.__hash__
    5557
    5658    def get_connection_params(self):
  • django/db/models/fields/__init__.py

    diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
    index b70d235..178401c 100644
    a b class Field(object):  
    135135            return self.creation_counter < other.creation_counter
    136136        return NotImplemented
    137137
    138     __hash__ = object.__hash__
     138    def __hash__(self):
     139        return hash(self.creation_counter)
    139140
    140141    def __deepcopy__(self, memodict):
    141142        # We don't have to deepcopy very much here, since most things are not
  • django/dispatch/saferef.py

    diff --git a/django/dispatch/saferef.py b/django/dispatch/saferef.py
    index 7423669..c7731d4 100644
    a b class BoundMethodWeakref(object):  
    152152
    153153    __repr__ = __str__
    154154
    155     __hash__ = object.__hash__
     155    def __hash__(self):
     156        return hash(self.key)
    156157
    157158    def __bool__( self ):
    158159        """Whether we are still a valid reference"""
  • django/test/html.py

    diff --git a/django/test/html.py b/django/test/html.py
    index 2f6e4c9..cda9dfa 100644
    a b class Element(object):  
    8585            return False
    8686        return True
    8787
    88     __hash__ = object.__hash__
     88    def __hash__(self):
     89        return hash((self.name,) + tuple(a for a in self.attributes))
    8990
    9091    def __ne__(self, element):
    9192        return not self.__eq__(element)
  • django/utils/functional.py

    diff --git a/django/utils/functional.py b/django/utils/functional.py
    index 1b5200c..6135175 100644
    a b def lazy(func, *resultclasses):  
    150150                other = other.__cast()
    151151            return self.__cast() < other
    152152
    153         __hash__ = object.__hash__
     153        def __hash__(self):
     154            return hash(self.__cast())
    154155
    155156        def __mod__(self, rhs):
    156157            if self._delegate_bytes and not six.PY3:
Back to Top