1. Armin Rigo
  2. cpython-withatomic

Commits

Victor Stinner  committed bd73ede

Issue #12451: distutils now opens the setup script in binary mode to read the
encoding cookie, instead of opening it in UTF-8.

  • Participants
  • Parent commits 450209e
  • Branches 3.2

Comments (0)

Files changed (2)

File Lib/distutils/core.py

View file
  • Ignore whitespace
 
 __revision__ = "$Id$"
 
-import sys, os
+import os
+import sys
 
 from distutils.debug import DEBUG
 from distutils.errors import *
             sys.argv[0] = script_name
             if script_args is not None:
                 sys.argv[1:] = script_args
-            f = open(script_name)
-            try:
+            with open(script_name, 'rb') as f:
                 exec(f.read(), g, l)
-            finally:
-                f.close()
         finally:
             sys.argv = save_argv
             _setup_stop_after = None

File Misc/NEWS

View file
  • Ignore whitespace
 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
   check or set the MACOSX_DEPLOYMENT_TARGET environment variable for the
   interpreter process.  This could cause failures in non-Distutils subprocesses