[clang] d4f9675 - [analyzer] decode() a bytes object to make Python3 happy

Jeremy Morse via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 4 09:12:59 PST 2020


Author: Jeremy Morse
Date: 2020-03-04T17:12:48Z
New Revision: d4f9675b5509e26573058318682a9ed5d7aaf320

URL: https://github.com/llvm/llvm-project/commit/d4f9675b5509e26573058318682a9ed5d7aaf320
DIFF: https://github.com/llvm/llvm-project/commit/d4f9675b5509e26573058318682a9ed5d7aaf320.diff

LOG: [analyzer] decode() a bytes object to make Python3 happy

The output of subprocess.check_output is decode()'d through the rest of
this python program, but one appears to have been missed for the output
of the call to "clang -print-file-name=include".

On Windows, with Python 3.6, this leads to the 'args' array being a mix of
bytes and strings, which causes exceptions later down the line.

I can't easily test with python2 on Windows, but python2 on Ubuntu 18.04
was happy with this change.

Added: 
    

Modified: 
    clang/test/Analysis/check-analyzer-fixit.py

Removed: 
    


################################################################################
diff  --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py
index 1d159aedec91..6a8f6859f816 100644
--- a/clang/test/Analysis/check-analyzer-fixit.py
+++ b/clang/test/Analysis/check-analyzer-fixit.py
@@ -63,7 +63,7 @@ def run_test_once(args, extra_args):
 
     try:
         builtin_include_dir = subprocess.check_output(
-            ['clang', '-print-file-name=include'], stderr=subprocess.STDOUT)
+            ['clang', '-print-file-name=include'], stderr=subprocess.STDOUT).decode()
     except subprocess.CalledProcessError as e:
         print('Cannot print Clang include directory: ' + e.output.decode())
 


        


More information about the cfe-commits mailing list