[PATCH] D58820: Fix update_mir_test_checks.py to run on python3

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 2 03:13:40 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL355268: Fix update_mir_test_checks.py to run on python3 (authored by RKSimon, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D58820?vs=188886&id=189041#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D58820

Files:
  llvm/trunk/utils/update_mir_test_checks.py


Index: llvm/trunk/utils/update_mir_test_checks.py
===================================================================
--- llvm/trunk/utils/update_mir_test_checks.py
+++ llvm/trunk/utils/update_mir_test_checks.py
@@ -62,6 +62,8 @@
         with open(ir) as ir_file:
             stdout = subprocess.check_output('{} {}'.format(self.bin, args),
                                              shell=True, stdin=ir_file)
+            if sys.version_info[0] > 2:
+              stdout = stdout.decode()
             # Fix line endings to unix CR style.
             stdout = stdout.replace('\r\n', '\n')
         return stdout
@@ -408,7 +410,7 @@
     log('Writing {} lines to {}...'.format(len(output_lines), test), verbose)
 
     with open(test, 'wb') as fd:
-        fd.writelines([l + '\n' for l in output_lines])
+        fd.writelines(['{}\n'.format(l).encode('utf-8') for l in output_lines])
 
 
 def main():


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58820.189041.patch
Type: text/x-patch
Size: 911 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190302/f0239cab/attachment.bin>


More information about the llvm-commits mailing list