From: Victor Stinner Date: Wed, 29 Jun 2011 18:01:29 +0000 (+0200) Subject: Issue #12400: regrtest.runtest() uses stream.seek(0) before .truncate() X-Git-Tag: v3.2.2rc1~178 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fcc2a21fae20b312e913a26121a12752ba768ad1;p=python Issue #12400: regrtest.runtest() uses stream.seek(0) before .truncate() .truncate(0) doesn't rewind. --- diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index f1ef715610..14fa00591b 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -791,9 +791,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 = runtest.stringio - stream.truncate(0) + stream = io.StringIO() + runtest.stringio = stream + else: + stream = runtest.stringio + stream.seek(0) + stream.truncate() orig_stdout = sys.stdout orig_stderr = sys.stderr