Close #17702: On error, os.environb now removes suppress the except context

when raising a new KeyError with the original key.
This commit is contained in:
Victor Stinner 2013-08-23 19:19:15 +02:00
parent f1e0273023
commit 0c2dd0c0a9
3 changed files with 8 additions and 2 deletions

View file

@ -644,10 +644,13 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol):
with self.assertRaises(KeyError) as cm:
os.environ[missing]
self.assertIs(cm.exception.args[0], missing)
self.assertTrue(cm.exception.__suppress_context__)
with self.assertRaises(KeyError) as cm:
del os.environ[missing]
self.assertIs(cm.exception.args[0], missing)
self.assertTrue(cm.exception.__suppress_context__)
class WalkTests(unittest.TestCase):
"""Tests for os.walk()."""