summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-09-10 20:54:53 (GMT)
committerFred Drake <fdrake@acm.org>1999-09-10 20:54:53 (GMT)
commit81ffe75d1c89584efd43040e3c9c7b006dde6942 (patch)
tree7803637b25a818ebac42e17793c23179dbf53d06 /Lib
parent75ae7e7dfa49a3e1d094d3a4f1dc2782323f347d (diff)
downloadcpython-81ffe75d1c89584efd43040e3c9c7b006dde6942.zip
cpython-81ffe75d1c89584efd43040e3c9c7b006dde6942.tar.gz
cpython-81ffe75d1c89584efd43040e3c9c7b006dde6942.tar.bz2
Message.__delitem__(): If the key doesn't exist in the dictionary,
raise KeyError instead of failing silently!
Diffstat (limited to 'Lib')
-rw-r--r--Lib/rfc822.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/rfc822.py b/Lib/rfc822.py
index 8721994..dcf059c 100644
--- a/Lib/rfc822.py
+++ b/Lib/rfc822.py
@@ -397,11 +397,11 @@ class Message:
def __delitem__(self, name):
"""Delete all occurrences of a specific header, if it is present."""
- name = string.lower(name)
- if not self.dict.has_key(name):
- return
- del self.dict[name]
- name = name + ':'
+ lowname = string.lower(name)
+ if not self.dict.has_key(lowname):
+ raise KeyError, name
+ del self.dict[lowname]
+ name = lowname + ':'
n = len(name)
list = []
hit = 0