Commit d262997c authored by Victor Stinner's avatar Victor Stinner

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.
parent dc4f6599
...@@ -258,6 +258,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, ...@@ -258,6 +258,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
on the command line. on the command line.
""" """
replace_stdout()
support.record_original_stdout(sys.stdout) support.record_original_stdout(sys.stdout)
try: try:
opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:', opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:',
...@@ -376,7 +378,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, ...@@ -376,7 +378,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
elif o in ('-j', '--multiprocess'): elif o in ('-j', '--multiprocess'):
use_mp = int(a) use_mp = int(a)
elif o == '--slaveargs': elif o == '--slaveargs':
replace_stdout()
args, kwargs = json.loads(a) args, kwargs = json.loads(a)
try: try:
result = runtest(*args, **kwargs) result = runtest(*args, **kwargs)
...@@ -515,8 +516,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, ...@@ -515,8 +516,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
else: else:
tests = iter(selected) tests = iter(selected)
replace_stdout()
if use_mp: if use_mp:
try: try:
from threading import Thread from threading import Thread
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment