From 9209b9f7ce6ecb4d9518037b2463bbedd544dcfc Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 20 Jan 2015 20:48:18 -0500 Subject: Decode file as latin-1 when opening to ensure decoding any bytes. --- setuptools/command/easy_install.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'setuptools/command/easy_install.py') 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=''): 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 == '#!' -- cgit v1.2.1