summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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