summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/packaging/metadata.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/packaging/metadata.py b/Lib/packaging/metadata.py
index 2d0ffa4..2993ebb 100644
--- a/Lib/packaging/metadata.py
+++ b/Lib/packaging/metadata.py
@@ -229,8 +229,10 @@ class Metadata:
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):