mirror of
https://github.com/python/cpython.git
synced 2025-07-15 23:35:23 +00:00
bpo-22831: Use "with" to avoid possible fd leaks in tools (part 2). (GH-10927)
This commit is contained in:
parent
afbb7a371f
commit
172bb39452
27 changed files with 249 additions and 259 deletions
|
@ -61,7 +61,8 @@ def gencodecs(prefix):
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue