mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Always close files in distutils code and tests (#10252).
This commit is contained in:
parent
afb078dd26
commit
bee5cef7db
24 changed files with 261 additions and 171 deletions
|
@ -234,6 +234,8 @@ def write_file (filename, contents):
|
|||
sequence of strings without line terminators) to it.
|
||||
"""
|
||||
f = open(filename, "w")
|
||||
for line in contents:
|
||||
f.write(line + "\n")
|
||||
f.close()
|
||||
try:
|
||||
for line in contents:
|
||||
f.write(line + "\n")
|
||||
finally:
|
||||
f.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue