Commit 64f5d63b 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 4a6183a2
......@@ -31,7 +31,10 @@ class Log:
# emulate backslashreplace error handler
encoding = stream.encoding
msg = msg.encode(encoding, "backslashreplace").decode(encoding)
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):
......
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