summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-29 18:03:13 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-29 18:03:13 (GMT)
commite15bfeb8ced1e7e0494cf54f5a5ef59fb1ed1254 (patch)
tree64d6a1b5dccd1ac80f0e5db41822c1fc11b4eea9 /Lib/test/regrtest.py
parente6db1440d8975f89e821dd656c5399e11ee288b5 (diff)
parentfcc2a21fae20b312e913a26121a12752ba768ad1 (diff)
downloadcpython-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-xLib/test/regrtest.py9
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