[Python-checkins] cpython: Make one function in packaging.metadata simpler

eric.araujo python-checkins at python.org
Wed Oct 19 21:32:59 CEST 2011


http://hg.python.org/cpython/rev/2e047702df7f
changeset:   73007:2e047702df7f
user:        Éric Araujo <merwok at netwok.org>
date:        Wed Oct 19 08:50:49 2011 +0200
summary:
  Make one function in packaging.metadata simpler

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


diff --git a/Lib/packaging/metadata.py b/Lib/packaging/metadata.py
--- a/Lib/packaging/metadata.py
+++ b/Lib/packaging/metadata.py
@@ -185,6 +185,7 @@
 
 _FILESAFE = re.compile('[^A-Za-z0-9.]+')
 
+
 class Metadata:
     """The metadata of a release.
 
@@ -228,10 +229,8 @@
 
     def __delitem__(self, name):
         field_name = self._convert_name(name)
-        try:
-            del self._fields[field_name]
-        except KeyError:
-            raise KeyError(name)
+        # we let a KeyError propagate
+        del self._fields[field_name]
         self._set_best_version()
 
     def __contains__(self, name):

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


More information about the Python-checkins mailing list