diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-19 17:00:07 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-19 17:00:07 (GMT) |
commit | 2ca03c1f7f476445019e67d6b44189b85259ef17 (patch) | |
tree | 0790187fb6ed9a89c3199f37bd90abd3a5236ec7 /Lib/distutils/log.py | |
parent | 9ca9c25bcd9d4b771be6fee34a105546d1c8d666 (diff) | |
download | cpython-2ca03c1f7f476445019e67d6b44189b85259ef17.zip cpython-2ca03c1f7f476445019e67d6b44189b85259ef17.tar.gz cpython-2ca03c1f7f476445019e67d6b44189b85259ef17.tar.bz2 |
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).
Diffstat (limited to 'Lib/distutils/log.py')
-rw-r--r-- | Lib/distutils/log.py | 4 |
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() |