mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
packaging: use with open() instead of try/finally: close
This commit is contained in:
parent
0e3f3a7076
commit
21a9c748aa
11 changed files with 41 additions and 69 deletions
|
@ -38,11 +38,8 @@ class InstallScriptsTestCase(support.TempdirManager,
|
|||
|
||||
def write_script(name, text):
|
||||
expected.append(name)
|
||||
f = open(os.path.join(source, name), "w")
|
||||
try:
|
||||
with open(os.path.join(source, name), "w") as f:
|
||||
f.write(text)
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
write_script("script1.py", ("#! /usr/bin/env python2.3\n"
|
||||
"# bogus script w/ Python sh-bang\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue