[llvm] r307669 - [lit] Fix import StringIO errors in Python 3

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 09:12:53 PDT 2017


Author: rnk
Date: Tue Jul 11 09:12:53 2017
New Revision: 307669

URL: http://llvm.org/viewvc/llvm-project?rev=307669&view=rev
Log:
[lit] Fix import StringIO errors in Python 3

Remove the cStringIO micro-optimization, as it isn't portable to Python
3.

Modified:
    llvm/trunk/utils/lit/lit/TestRunner.py

Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=307669&r1=307668&r2=307669&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Tue Jul 11 09:12:53 2017
@@ -6,9 +6,9 @@ import tempfile
 import threading
 
 try:
-    import cStringIO as StringIO
+    from StringIO import StringIO
 except ImportError:
-    import StringIO
+    from io import StringIO
 
 from lit.ShCommands import GlobItem
 import lit.ShUtil as ShUtil
@@ -240,7 +240,7 @@ def executeBuiltinEcho(cmd, shenv):
     is_redirected = True
     if stdout == subprocess.PIPE:
         is_redirected = False
-        stdout = StringIO.StringIO()
+        stdout = StringIO()
     elif kIsWindows:
         # Reopen stdout in binary mode to avoid CRLF translation. The versions
         # of echo we are replacing on Windows all emit plain LF, and the LLVM




More information about the llvm-commits mailing list