Commit 0afada16 authored by Julien Malard's avatar Julien Malard Committed by Éric Araujo

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

This caused installation errors in some cases on Windows.
Patch by Julien Malard.
parent d700f97b
......@@ -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):
......
Fix distutils logging for non-ASCII strings. This caused installation issues on Windows.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment