diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2014-12-31 14:29:26 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-12-31 14:29:26 -0500 |
| commit | 86a0dc8419a3649389bd7d58a1f7c79bae0baad6 (patch) | |
| tree | 8213efed1d8f84250ffd0d2f92a1d0686a842be6 /setuptools/archive_util.py | |
| parent | eb61e5c989cda3f5e021150f91561a88ba6db73e (diff) | |
| download | python-setuptools-git-86a0dc8419a3649389bd7d58a1f7c79bae0baad6.tar.gz | |
Use simple context manager; don't bother deleting the variable.
Diffstat (limited to 'setuptools/archive_util.py')
| -rwxr-xr-x | setuptools/archive_util.py | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py index 2cd5b34e..b3c9fa56 100755 --- a/setuptools/archive_util.py +++ b/setuptools/archive_util.py @@ -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) |
