[PATCH] D68222: [LNT] Python 3 support: fix text/binary confusion in profile support

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 08:35:23 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL373617: [LNT] Python 3 support: fix text/binary confusion in profile support (authored by thopre, committed by ).
Herald added a project: LLVM.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68222/new/

https://reviews.llvm.org/D68222

Files:
  lnt/trunk/lnt/testing/profile/perf.py
  lnt/trunk/lnt/testing/profile/profilev1impl.py
  lnt/trunk/lnt/testing/profile/profilev2impl.py


Index: lnt/trunk/lnt/testing/profile/profilev2impl.py
===================================================================
--- lnt/trunk/lnt/testing/profile/profilev2impl.py
+++ lnt/trunk/lnt/testing/profile/profilev2impl.py
@@ -558,7 +558,7 @@
     def checkFile(fn):
         # The first number is the version (2); ULEB encoded this is simply
         # 0x02.
-        return ord(open(fn).read(1)) == 2
+        return open(fn, 'rb').read(1) == b'\x02'
 
     @staticmethod
     def deserialize(fobj):
Index: lnt/trunk/lnt/testing/profile/profilev1impl.py
===================================================================
--- lnt/trunk/lnt/testing/profile/profilev1impl.py
+++ lnt/trunk/lnt/testing/profile/profilev1impl.py
@@ -43,7 +43,7 @@
     @staticmethod
     def checkFile(fn):
         # "zlib compressed data" - 78 9C
-        return open(fn).read(2) == '\x78\x9c'
+        return open(fn, 'rb').read(2) == b'\x78\x9c'
 
     @staticmethod
     def deserialize(fobj):
Index: lnt/trunk/lnt/testing/profile/perf.py
===================================================================
--- lnt/trunk/lnt/testing/profile/perf.py
+++ lnt/trunk/lnt/testing/profile/perf.py
@@ -18,7 +18,7 @@
 
     @staticmethod
     def checkFile(fn):
-        return open(fn).read(8) == 'PERFILE2'
+        return open(fn, 'rb').read(8) == b'PERFILE2'
 
     @staticmethod
     def deserialize(f, nm='nm', objdump='objdump', propagateExceptions=False):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68222.223031.patch
Type: text/x-patch
Size: 1442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191003/608f0021/attachment.bin>


More information about the llvm-commits mailing list