(merge 3.2) Issue #12400: regrtest.runtest() uses stream.seek(0) before .truncate()

.truncate(0) doesn't rewind.
This commit is contained in:
Victor Stinner 2011-06-29 20:03:13 +02:00
commit e15bfeb8ce
1 changed files with 6 additions and 3 deletions

View File

@ -845,9 +845,12 @@ def runtest(test, verbose, quiet,
# tests keep a reference to sys.stdout or sys.stderr
# (eg. test_argparse).
if runtest.stringio is None:
runtest.stringio = io.StringIO()
stream = io.StringIO()
runtest.stringio = stream
else:
stream = runtest.stringio
stream.truncate(0)
stream.seek(0)
stream.truncate()
orig_stdout = sys.stdout
orig_stderr = sys.stderr