diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-08-19 19:47:55 +0100 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-08-19 19:47:55 +0100 |
commit | 50aaf9938a4437db7f2949df6ecb6460c789ff28 (patch) | |
tree | b435a989a19cc4e35a5ef531e5eef5f8463aa815 /setuptools/command/easy_install.py | |
parent | 3f2ccea66a3deee1e4a4234d695dd94282ec3819 (diff) | |
download | external_python_setuptools-50aaf9938a4437db7f2949df6ecb6460c789ff28.tar.gz external_python_setuptools-50aaf9938a4437db7f2949df6ecb6460c789ff28.tar.bz2 external_python_setuptools-50aaf9938a4437db7f2949df6ecb6460c789ff28.zip |
Open file in context manager
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-x | setuptools/command/easy_install.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 15b260dd..0e912156 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1538,9 +1538,8 @@ class PthDistributions(Environment): if os.path.islink(self.filename): os.unlink(self.filename) - f = open(self.filename, 'wt') - f.write(data) - f.close() + with open(self.filename, 'wt') as f: + f.write(data) elif os.path.exists(self.filename): log.debug("Deleting empty %s", self.filename) |