[lld] r224947 - [py3] Make this test compatible with Python 3 where bytes and

Chandler Carruth chandlerc at gmail.com
Mon Dec 29 11:23:31 PST 2014


Author: chandlerc
Date: Mon Dec 29 13:23:31 2014
New Revision: 224947

URL: http://llvm.org/viewvc/llvm-project?rev=224947&view=rev
Log:
[py3] Make this test compatible with Python 3 where bytes and
strings don't mix so easily. This fixes the last remaining failure
I have in 'check-all' on a system with both Python3 and and Python2
installed.

Modified:
    lld/trunk/test/mach-o/Inputs/DependencyDump.py

Modified: lld/trunk/test/mach-o/Inputs/DependencyDump.py
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/Inputs/DependencyDump.py?rev=224947&r1=224946&r2=224947&view=diff
==============================================================================
--- lld/trunk/test/mach-o/Inputs/DependencyDump.py (original)
+++ lld/trunk/test/mach-o/Inputs/DependencyDump.py Mon Dec 29 13:23:31 2014
@@ -9,19 +9,19 @@ import sys
 
 f = open(sys.argv[1], "rb")
 byte = f.read(1)
-while byte != '':
-    if byte == '\000':
+while byte != b'':
+    if byte == b'\000':
         sys.stdout.write("linker-vers: ")
-    elif byte == '\020':
+    elif byte == b'\020':
         sys.stdout.write("input-file:  ")
-    elif byte == '\021':
+    elif byte == b'\021':
         sys.stdout.write("not-found:   ")
-    elif byte == '\100':
+    elif byte == b'\100':
         sys.stdout.write("output-file: ")
     byte = f.read(1)
-    while byte != '\000':
-        if byte != '\012':
-            sys.stdout.write(byte)
+    while byte != b'\000':
+        if byte != b'\012':
+            sys.stdout.write(byte.decode("ascii"))
         byte = f.read(1)
     sys.stdout.write("\n")
     byte = f.read(1)





More information about the llvm-commits mailing list