[commit: ghc] wip/python3: Do not set buffering under Python 3, show a warning with Python 3 (7b4411e)
git at git.haskell.org
git at git.haskell.org
Sat Sep 20 23:21:19 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/python3
Link : http://ghc.haskell.org/trac/ghc/changeset/7b4411e49ee76ae2f3428e4f3cc5f1d6839469d4/ghc
>---------------------------------------------------------------
commit 7b4411e49ee76ae2f3428e4f3cc5f1d6839469d4
Author: Krzysztof Gogolewski <krz.gogolewski at gmail.com>
Date: Sun Sep 21 01:15:33 2014 +0200
Do not set buffering under Python 3, show a warning with Python 3
I am not happy with this solution; a better way is to use uniformly
unicode or bytes in both Pythons, but this seems too disruptive for now.
>---------------------------------------------------------------
7b4411e49ee76ae2f3428e4f3cc5f1d6839469d4
testsuite/driver/runtests.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 00a0b34..883bda7 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -23,6 +23,11 @@ try:
except:
pass
+PYTHON3 = sys.version_info >= (3, 0)
+if PYTHON3:
+ print("*** WARNING: running testsuite using Python 3.\n"
+ "*** Python 3 support is experimental. See Trac #9184.")
+
from testutil import *
from testglobals import *
@@ -253,9 +258,13 @@ t.start_time = time.localtime()
print('Beginning test run at', time.strftime("%c %Z",t.start_time))
-# set stdout to unbuffered (is this the best way to do it?)
sys.stdout.flush()
-sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w", 0)
+if PYTHON3:
+ # in Python 3, we output text, which cannot be unbuffered
+ sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w")
+else:
+ # set stdout to unbuffered (is this the best way to do it?)
+ sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w", 0)
# First collect all the tests to be run
for file in t_files:
More information about the ghc-commits
mailing list