diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-06-29 18:03:13 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-06-29 18:03:13 (GMT) |
commit | e15bfeb8ced1e7e0494cf54f5a5ef59fb1ed1254 (patch) | |
tree | 64d6a1b5dccd1ac80f0e5db41822c1fc11b4eea9 /Lib/test/regrtest.py | |
parent | e6db1440d8975f89e821dd656c5399e11ee288b5 (diff) | |
parent | fcc2a21fae20b312e913a26121a12752ba768ad1 (diff) | |
download | cpython-e15bfeb8ced1e7e0494cf54f5a5ef59fb1ed1254.zip cpython-e15bfeb8ced1e7e0494cf54f5a5ef59fb1ed1254.tar.gz cpython-e15bfeb8ced1e7e0494cf54f5a5ef59fb1ed1254.tar.bz2 |
(merge 3.2) Issue #12400: regrtest.runtest() uses stream.seek(0) before .truncate()
.truncate(0) doesn't rewind.
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-x | Lib/test/regrtest.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index a82c6ee..1426c3e 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -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 = 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 |