summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/log.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/distutils/log.py b/Lib/distutils/log.py
index 7588570..b301a83 100644
--- a/Lib/distutils/log.py
+++ b/Lib/distutils/log.py
@@ -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()