diff options
Diffstat (limited to 'Lib/test/test_argparse.py')
-rw-r--r-- | Lib/test/test_argparse.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index cf0f8e49b5..f01c65fbea 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -4160,7 +4160,8 @@ class TestEncoding(TestCase): def _test_module_encoding(self, path): path, _ = os.path.splitext(path) path += ".py" - codecs.open(path, 'r', 'utf8').read() + with codecs.open(path, 'r', 'utf8') as f: + f.read() def test_argparse_module_encoding(self): self._test_module_encoding(argparse.__file__) |