summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-25 00:01:55 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-25 00:01:55 (GMT)
commitbe6210363e1bd275df5a31c394f39b934dad1b14 (patch)
tree931f18a9f451005549e99f4c74c41a09ddf4af19 /Lib/test/regrtest.py
parent6daa33c8acf47bcc41ea827e7b3dbcc5fae9f771 (diff)
downloadcpython-be6210363e1bd275df5a31c394f39b934dad1b14.zip
cpython-be6210363e1bd275df5a31c394f39b934dad1b14.tar.gz
cpython-be6210363e1bd275df5a31c394f39b934dad1b14.tar.bz2
Issue #8533: regrtest replaces also sys.stdout on Windows
Replace sys.stdout to use backslashreplace. Use '\n' newline on all operating systems.
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 04e87e3..b5e5127 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -794,17 +794,14 @@ def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS):
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()