From 249e5853496ec108dc78e58c003bf46315b50ffc Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 15:31:47 -0400 Subject: Extract variable --- setuptools/sandbox.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setuptools/sandbox.py') diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 7985e9ee..a0d3dc61 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -30,7 +30,8 @@ def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ - with open(filename, 'rb') as stream: + mode = 'rb' + with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals -- cgit v1.2.3 From 59e3528c710363e167e0860aab4fd1a611cc058b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 1 Aug 2014 15:36:08 -0400 Subject: Correct execfile implementation for Python 2.6. Fixes #236. --- setuptools/sandbox.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'setuptools/sandbox.py') diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index a0d3dc61..e79a13a8 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -31,6 +31,10 @@ def _execfile(filename, globals, locals=None): Python 3 implementation of execfile. """ mode = 'rb' + # Python 2.6 compile requires LF for newlines, so use deprecated + # Universal newlines support. + if sys.version_info < (2, 7): + mode += 'U' with open(filename, mode) as stream: script = stream.read() if locals is None: -- cgit v1.2.3