Commit b78e3623 authored by Victor Stinner's avatar Victor Stinner

Issue #8663: distutils.log emulates backslashreplace error handler. Fix

compilation in a non-ASCII directory if stdout encoding is ASCII (eg. if stdout
is not a TTY).
parent a99ff5b3
......@@ -27,6 +27,10 @@ class Log:
stream = sys.stderr
else:
stream = sys.stdout
if stream.errors == 'strict':
# emulate backslashreplace error handler
encoding = stream.encoding
msg = msg.encode(encoding, "backslashreplace").decode(encoding)
stream.write('%s\n' % msg)
stream.flush()
......
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