mirror of
https://github.com/python/cpython.git
synced 2025-09-10 18:58:35 +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
|
@ -150,8 +150,10 @@ class MutableString(UserString, collections.MutableSequence):
|
|||
warnpy3k('the class UserString.MutableString has been removed in '
|
||||
'Python 3.0', stacklevel=2)
|
||||
self.data = string
|
||||
def __hash__(self):
|
||||
raise TypeError, "unhashable type (it is mutable)"
|
||||
|
||||
# We inherit object.__hash__, so we must deny this explicitly
|
||||
__hash__ = None
|
||||
|
||||
def __setitem__(self, index, sub):
|
||||
if isinstance(index, slice):
|
||||
if isinstance(sub, UserString):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue