mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #12112: fix the encoding of setup.py in the packaging module
* read: use tokenize.detect_encoding() * write: use 'utf-8'
This commit is contained in:
parent
975077a889
commit
9cf6d13141
2 changed files with 7 additions and 4 deletions
|
@ -32,6 +32,7 @@ import glob
|
|||
import re
|
||||
import shutil
|
||||
import sysconfig
|
||||
import tokenize
|
||||
from configparser import RawConfigParser
|
||||
from textwrap import dedent
|
||||
from hashlib import md5
|
||||
|
@ -116,7 +117,9 @@ def load_setup():
|
|||
This function load the setup file in all cases (even if it have already
|
||||
been loaded before, because we are monkey patching its setup function with
|
||||
a particular one"""
|
||||
with open("setup.py") as f:
|
||||
with open("setup.py", "rb") as f:
|
||||
encoding, lines = tokenize.detect_encoding(f.readline)
|
||||
with open("setup.py", encoding=encoding) as f:
|
||||
imp.load_module("setup", f, "setup.py", (".py", "r", imp.PY_SOURCE))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue