summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-29 18:01:29 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-29 18:01:29 (GMT)
commitfcc2a21fae20b312e913a26121a12752ba768ad1 (patch)
treeae0117cbd7684216c6c23f8bacf5feb974913863 /Lib/test
parent592f679dce01dce70f1f917270e84e09c92ff337 (diff)
downloadcpython-fcc2a21fae20b312e913a26121a12752ba768ad1.zip
cpython-fcc2a21fae20b312e913a26121a12752ba768ad1.tar.gz
cpython-fcc2a21fae20b312e913a26121a12752ba768ad1.tar.bz2
Issue #12400: regrtest.runtest() uses stream.seek(0) before .truncate()
.truncate(0) doesn't rewind.
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/regrtest.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index f1ef715..14fa005 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