mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
Merged revisions 81359-81361 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r81359 | victor.stinner | 2010-05-19 19:00:07 +0200 (mer., 19 mai 2010) | 4 lines 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). ........ r81360 | victor.stinner | 2010-05-19 19:11:19 +0200 (mer., 19 mai 2010) | 5 lines regrtest.py: call replace_stdout() before the first call to print() print("== ", os.getcwd()) fails if the current working directory is not ASCII whereas sys.stdout encoding is ASCII. ........ r81361 | victor.stinner | 2010-05-19 19:15:50 +0200 (mer., 19 mai 2010) | 2 lines Oops, add the new test_log.py for distutils test suite (missing part of r81359) ........
This commit is contained in:
parent
20c043b40c
commit
db19fb6bb1
4 changed files with 46 additions and 1 deletions
|
|
@ -27,6 +27,10 @@ def _log(self, level, msg, args):
|
|||
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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue