Commit 86a0dc84 authored by Jason R. Coombs's avatar Jason R. Coombs

Use simple context manager; don't bother deleting the variable.

parent eb61e5c9
......@@ -115,12 +115,8 @@ def unpack_zipfile(filename, extract_dir, progress_filter=default_filter):
# file
ensure_directory(target)
data = z.read(info.filename)
f = open(target, 'wb')
try:
with open(target, 'wb') as f:
f.write(data)
finally:
f.close()
del data
unix_attributes = info.external_attr >> 16
if unix_attributes:
os.chmod(target, unix_attributes)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment