[Python-checkins] cpython: Issue #8533: regrtest replaces also sys.stdout on Windows

victor.stinner python-checkins at python.org
Wed May 25 02:02:56 CEST 2011


http://hg.python.org/cpython/rev/8be9eaf5829f
changeset: 70366:8be9eaf5829f
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Wed May 25 02:01:55 2011 +0200
summary:
 Issue #8533: regrtest replaces also sys.stdout on Windows
Replace sys.stdout to use backslashreplace. Use '\n' newline on all operating
systems.
files:
 Lib/test/regrtest.py | 7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -794,17 +794,14 @@
 def replace_stdout():
 """Set stdout encoder error handler to backslashreplace (as stderr error
 handler) to avoid UnicodeEncodeError when printing a traceback"""
- if os.name == "nt":
- # Replace sys.stdout breaks the stdout newlines on Windows: issue #8533
- return
-
 import atexit
 
 stdout = sys.stdout
 sys.stdout = open(stdout.fileno(), 'w',
 encoding=stdout.encoding,
 errors="backslashreplace",
- closefd=False)
+ closefd=False,
+ newline='\n')
 
 def restore_stdout():
 sys.stdout.close()
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /