[Python-checkins] r81359 - in python/branches/py3k: Lib/distutils/log.py Misc/NEWS

victor.stinner python-checkins at python.org
Wed May 19 19:00:07 CEST 2010


Author: victor.stinner
Date: Wed May 19 19:00:07 2010
New Revision: 81359

Log:
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).


Modified:
   python/branches/py3k/Lib/distutils/log.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/distutils/log.py
==============================================================================
--- python/branches/py3k/Lib/distutils/log.py	(original)
+++ python/branches/py3k/Lib/distutils/log.py	Wed May 19 19:00:07 2010
@@ -27,6 +27,10 @@
                 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()
 

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Wed May 19 19:00:07 2010
@@ -370,6 +370,10 @@
 Library
 -------
 
+- 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).
+
 - Issue #8513: os.get_exec_path() supports b'PATH' key and bytes value.
   subprocess.Popen() and os._execvpe() support bytes program name. Add
   os.supports_bytes_environ flag: True if the native OS type of the environment


More information about the Python-checkins mailing list