mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +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
|
@ -71,11 +71,8 @@ class BuildScriptsTestCase(support.TempdirManager,
|
|||
return expected
|
||||
|
||||
def write_script(self, dir, name, text):
|
||||
f = open(os.path.join(dir, name), "w")
|
||||
try:
|
||||
with open(os.path.join(dir, name), "w") as f:
|
||||
f.write(text)
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
def test_version_int(self):
|
||||
source = self.mkdtemp()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue