summaryrefslogtreecommitdiff
path: root/Lib/os.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-08-23 19:19:15 +0200
committerVictor Stinner <victor.stinner@gmail.com>2013-08-23 19:19:15 +0200
commit7549e8f6529ab47e84253442819f40e4f092b679 (patch)
tree45aeb843b8612bd9c8622519ff9625414cd1dbd5 /Lib/os.py
parent921824c2f9311561e22ad100b8de5460da72bc26 (diff)
downloadcpython-7549e8f6529ab47e84253442819f40e4f092b679.tar.gz
Close #17702: On error, os.environb now removes suppress the except context
when raising a new KeyError with the original key.
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 06616c64d8..87689cc269 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -673,7 +673,7 @@ class _Environ(MutableMapping):
value = self._data[self.encodekey(key)]
except KeyError:
# raise KeyError with the original key value
- raise KeyError(key)
+ raise KeyError(key) from None
return self.decodevalue(value)
def __setitem__(self, key, value):
@@ -689,7 +689,7 @@ class _Environ(MutableMapping):
del self._data[encodedkey]
except KeyError:
# raise KeyError with the original key value
- raise KeyError(key)
+ raise KeyError(key) from None
def __iter__(self):
for key in self._data: