Fix __delitem__ to remove reference from given key
Previously, the __delitem__ method deleted the value and references from other keys, but did not remove the reference from the given key. This would cause the has_key method to incorrectly indicate that the key was present - even after it had been deleted.
This commit is contained in:
parent
ce4d00deb9
commit
bc72b26c4f
|
@ -151,6 +151,10 @@ class multi_key_dict(object):
|
|||
key_type = str(type(k))
|
||||
if (key_type in self.__dict__ and k in self.__dict__[key_type]):
|
||||
del self.__dict__[key_type][k]
|
||||
|
||||
# remove the reference from the given key
|
||||
del self.__dict__[key_type][key]
|
||||
|
||||
else:
|
||||
raise KeyError(key)
|
||||
|
||||
|
|
Loading…
Reference in New Issue