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:
Stephen Kappel 2015-03-18 15:22:58 -04:00
parent ce4d00deb9
commit bc72b26c4f
1 changed files with 4 additions and 0 deletions

View File

@ -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)