mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Issue 2235: __hash__ is once again inherited by default, but inheritance can be blocked explicitly so that collections.Hashable remains meaningful
This commit is contained in:
parent
9ace15ca25
commit
53663a695e
14 changed files with 134 additions and 134 deletions
|
@ -3697,10 +3697,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)"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue