mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
(Merge 3.3) 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:
commit
a93c6db68b
3 changed files with 8 additions and 2 deletions
|
@ -646,10 +646,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()."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue