summaryrefslogtreecommitdiff
path: root/Lib/distutils/command/build_scripts.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/command/build_scripts.py')
-rw-r--r--Lib/distutils/command/build_scripts.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py
index ec43477061..4b5b22ec20 100644
--- a/Lib/distutils/command/build_scripts.py
+++ b/Lib/distutils/command/build_scripts.py
@@ -126,10 +126,9 @@ class build_scripts(Command):
"The shebang ({!r}) is not decodable "
"from the script encoding ({})"
.format(shebang, encoding))
- outf = open(outfile, "wb")
- outf.write(shebang)
- outf.writelines(f.readlines())
- outf.close()
+ with open(outfile, "wb") as outf:
+ outf.write(shebang)
+ outf.writelines(f.readlines())
if f:
f.close()
else: