commit | 172bb39452ae8b3ccdf5d1f23ead46f44200cd49 | [log] [tgz] |
---|---|---|
author | Serhiy Storchaka <storchaka@gmail.com> | Sat Mar 30 08:33:02 2019 +0200 |
committer | GitHub <noreply@github.com> | Sat Mar 30 08:33:02 2019 +0200 |
tree | 5e1effbca3664b839a81eb7a7d62fa4974cfbfb1 | |
parent | afbb7a371fb44edc731344eab5b474ad8f7b57d7 [diff] [blame] |
bpo-22831: Use "with" to avoid possible fd leaks in tools (part 2). (GH-10927)
diff --git a/Tools/unicode/gencjkcodecs.py b/Tools/unicode/gencjkcodecs.py index ebccfc7..45866bf 100644 --- a/Tools/unicode/gencjkcodecs.py +++ b/Tools/unicode/gencjkcodecs.py
@@ -61,7 +61,8 @@ encoding=enc.lower(), owner=loc) codecpath = os.path.join(prefix, enc + '.py') - open(codecpath, 'w').write(code) + with open(codecpath, 'w') as f: + f.write(code) if __name__ == '__main__': import sys