Issue #12400: runtest() truncates the StringIO stream before a new test
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 75d8795..f1ef715 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -793,6 +793,7 @@
             if runtest.stringio is None:
                 runtest.stringio = io.StringIO()
             stream = runtest.stringio
+            stream.truncate(0)
 
             orig_stdout = sys.stdout
             orig_stderr = sys.stderr