[Python-checkins] cpython: The error message should contain the key as given, not normalized.

eric.araujo python-checkins at python.org
Tue Nov 15 16:13:54 CET 2011


http://hg.python.org/cpython/rev/c3c151519124
changeset:   73566:c3c151519124
user:        Éric Araujo <merwok at netwok.org>
date:        Mon Nov 14 19:45:30 2011 +0100
summary:
  The error message should contain the key as given, not normalized.

Backout of 2e047702df7f.  Reported by Jeremy Kloth.

files:
  Lib/packaging/metadata.py |  6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/Lib/packaging/metadata.py b/Lib/packaging/metadata.py
--- a/Lib/packaging/metadata.py
+++ b/Lib/packaging/metadata.py
@@ -229,8 +229,10 @@
 
     def __delitem__(self, name):
         field_name = self._convert_name(name)
-        # we let a KeyError propagate
-        del self._fields[field_name]
+        try:
+            del self._fields[field_name]
+        except KeyError:
+            raise KeyError(name)
         self._set_best_version()
 
     def __contains__(self, name):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list