Issue #6011: sysconfig and distutils.sysconfig use the surrogateescape error

handler to parse the Makefile file. Avoid a UnicodeDecodeError if the source
code directory name contains a non-ASCII character and the locale encoding is
ASCII.
This commit is contained in:
Victor Stinner 2010-10-23 17:02:31 +00:00
parent acd0fda1a4
commit 75d8c5cea2
4 changed files with 11 additions and 3 deletions

View file

@ -271,7 +271,7 @@ def parse_makefile(fn, g=None):
used instead of a new dictionary.
"""
from distutils.text_file import TextFile
fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1)
fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1, errors="surrogateescape")
if g is None:
g = {}