summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/log.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/log.py')
-rw-r--r--Lib/distutils/log.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/distutils/log.py b/Lib/distutils/log.py
index 3a6602b..8ef6b28 100644
--- a/Lib/distutils/log.py
+++ b/Lib/distutils/log.py
@@ -27,14 +27,13 @@ class Log:
stream = sys.stderr
else:
stream = sys.stdout
- if stream.errors == 'strict':
+ try:
+ stream.write('%s\n' % msg)
+ except UnicodeEncodeError:
# 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):