packaging: use with open() instead of try/finally: close

This commit is contained in:
Victor Stinner 2011-05-19 15:51:27 +02:00
parent 0e3f3a7076
commit 21a9c748aa
11 changed files with 41 additions and 69 deletions

View file

@ -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.