diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-20 20:48:18 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-20 20:48:18 -0500 |
commit | 9209b9f7ce6ecb4d9518037b2463bbedd544dcfc (patch) | |
tree | 0811f906d3115f89298d6cba13a66a05ae98c604 /setuptools/command/easy_install.py | |
parent | ad794c2809cc2ad0a48a14129dca82996f14af28 (diff) | |
download | external_python_setuptools-9209b9f7ce6ecb4d9518037b2463bbedd544dcfc.tar.gz external_python_setuptools-9209b9f7ce6ecb4d9518037b2463bbedd544dcfc.tar.bz2 external_python_setuptools-9209b9f7ce6ecb4d9518037b2463bbedd544dcfc.zip |
Decode file as latin-1 when opening to ensure decoding any bytes.
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 9978c132..5e25f2cd 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1801,9 +1801,8 @@ def is_python(text, filename='<string>'): def is_sh(executable): """Determine if the specified executable is a .sh (contains a #! line)""" try: - fp = open(executable) - magic = fp.read(2) - fp.close() + with open(executable, encoding='latin-1') as fp: + magic = fp.read(2) except (OSError, IOError): return executable return magic == '#!' |