bpo-34421 avoid unicode error in distutils logging (GH-8799)

This caused installation errors in some cases on Windows.
Patch by Julien Malard.
This commit is contained in:
Julien Malard 2018-09-09 02:01:26 +05:30 committed by Éric Araujo
parent d700f97b62
commit 0afada163c
2 changed files with 5 additions and 1 deletions

View File

@ -31,7 +31,10 @@ class Log:
# emulate backslashreplace error handler
encoding = stream.encoding
msg = msg.encode(encoding, "backslashreplace").decode(encoding)
stream.write('%s\n' % msg)
try:
stream.write('%s\n' % msg)
except UnicodeEncodeError:
stream.write('%s\n' % msg.encode('unicode-escape').decode('ascii'))
stream.flush()
def log(self, level, msg, *args):

View File

@ -0,0 +1 @@
Fix distutils logging for non-ASCII strings. This caused installation issues on Windows.