Issue #12451: distutils now opens the setup script in binary mode to read the

encoding cookie, instead of opening it in UTF-8.
This commit is contained in:
Victor Stinner 2011-06-30 15:40:22 +02:00
parent fcc2a21fae
commit dc9b1ea02e
2 changed files with 6 additions and 5 deletions

View File

@ -8,7 +8,8 @@ really defined in distutils.dist and distutils.cmd.
__revision__ = "$Id$" __revision__ = "$Id$"
import sys, os import os
import sys
from distutils.debug import DEBUG from distutils.debug import DEBUG
from distutils.errors import * from distutils.errors import *
@ -215,11 +216,8 @@ def run_setup (script_name, script_args=None, stop_after="run"):
sys.argv[0] = script_name sys.argv[0] = script_name
if script_args is not None: if script_args is not None:
sys.argv[1:] = script_args sys.argv[1:] = script_args
f = open(script_name) with open(script_name, 'rb') as f:
try:
exec(f.read(), g, l) exec(f.read(), g, l)
finally:
f.close()
finally: finally:
sys.argv = save_argv sys.argv = save_argv
_setup_stop_after = None _setup_stop_after = None

View File

@ -25,6 +25,9 @@ Core and Builtins
Library Library
------- -------
- Issue #12451: distutils now opens the setup script in binary mode to read the
encoding cookie, instead of opening it in UTF-8.
- Issue #9516: On Mac OS X, change Distutils to no longer globally attempt to - Issue #9516: On Mac OS X, change Distutils to no longer globally attempt to
check or set the MACOSX_DEPLOYMENT_TARGET environment variable for the check or set the MACOSX_DEPLOYMENT_TARGET environment variable for the
interpreter process. This could cause failures in non-Distutils subprocesses interpreter process. This could cause failures in non-Distutils subprocesses