Manual forward port of 64962 - use PyObject_HashNotImplemented as a tp_hash level indicator that the default hash implementation has not been inherited

This commit is contained in:
Nick Coghlan 2008-07-15 15:46:38 +00:00
parent e65282114e
commit d1abd25ed8
12 changed files with 122 additions and 94 deletions

View file

@ -3783,10 +3783,8 @@ class Context(object):
for flag in flags:
self._ignored_flags.remove(flag)
def __hash__(self):
"""A Context cannot be hashed."""
# We inherit object.__hash__, so we must deny this explicitly
raise TypeError("Cannot hash a Context.")
# We inherit object.__hash__, so we must deny this explicitly
__hash__ = None
def Etiny(self):
"""Returns Etiny (= Emin - prec + 1)"""