[Python-checkins] cpython (3.2): Issue #12400: regrtest.runtest() uses stream.seek(0) before .truncate()

victor.stinner python-checkins at python.org
Wed Jun 29 20:03:35 CEST 2011


http://hg.python.org/cpython/rev/450209efe272
changeset: 71080:450209efe272
branch: 3.2
parent: 71078:bc2f3fbda7e3
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Wed Jun 29 20:01:29 2011 +0200
summary:
 Issue #12400: regrtest.runtest() uses stream.seek(0) before .truncate()
.truncate(0) doesn't rewind.
files:
 Lib/test/regrtest.py | 9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -791,9 +791,12 @@
 # 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
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /