summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-05-19 17:00:07 +0000
committerVictor Stinner <victor.stinner@haypocalc.com>2010-05-19 17:00:07 +0000
commitb78e3623ca34400e29297da0409211a7d83728c6 (patch)
tree803c6ae8f14b164deece97305dc7eeac0f1b6f6b
parenta99ff5b39025ea4dc8a72f9e7f1d51a17f1aacdc (diff)
downloadpython-setuptools-git-b78e3623ca34400e29297da0409211a7d83728c6.tar.gz
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).
-rw-r--r--log.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/log.py b/log.py
index 75885708..b301a833 100644
--- a/log.py
+++ b/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()