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
|
@ -146,11 +146,8 @@ class TempdirManager:
|
|||
"""
|
||||
if isinstance(path, (list, tuple)):
|
||||
path = os.path.join(*path)
|
||||
f = open(path, 'w')
|
||||
try:
|
||||
with open(path, 'w') as f:
|
||||
f.write(content)
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
def create_dist(self, **kw):
|
||||
"""Create a stub distribution object and files.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue