[PATCH] D63311: Python 3: decode string as utf-8 to avoid type mismatch.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 08:37:59 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL363413: Python 3: decode string as utf-8 to avoid type mismatch. (authored by adrian, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D63311?vs=204772&id=204775#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63311

Files:
  lldb/trunk/examples/python/crashlog.py


Index: lldb/trunk/examples/python/crashlog.py
===================================================================
--- lldb/trunk/examples/python/crashlog.py
+++ lldb/trunk/examples/python/crashlog.py
@@ -58,7 +58,7 @@
     platform_system = platform.system()
     if platform_system == 'Darwin':
         # On Darwin, try the currently selected Xcode directory
-        xcode_dir = subprocess.check_output("xcode-select --print-path", shell=True)
+        xcode_dir = subprocess.check_output("xcode-select --print-path", shell=True).decode("utf-8")
         if xcode_dir:
             lldb_python_dirs.append(
                 os.path.realpath(
@@ -232,7 +232,7 @@
         if not os.path.exists(dsymForUUIDBinary):
             try:
                 dsymForUUIDBinary = subprocess.check_output('which dsymForUUID',
-                                                            shell=True).rstrip('\n')
+                                                            shell=True).decode("utf-8").rstrip('\n')
             except:
                 dsymForUUIDBinary = ""
 
@@ -300,7 +300,7 @@
             if os.path.exists(self.dsymForUUIDBinary):
                 dsym_for_uuid_command = '%s %s' % (
                     self.dsymForUUIDBinary, uuid_str)
-                s = subprocess.check_output(dsym_for_uuid_command, shell=True)
+                s = subprocess.check_output(dsym_for_uuid_command, shell=True).decode("utf-8")
                 if s:
                     try:
                         plist_root = read_plist(s)
@@ -326,7 +326,7 @@
                 try:
                     dsym = subprocess.check_output(
                         ["/usr/bin/mdfind",
-                         "com_apple_xcode_dsym_uuids == %s"%uuid_str])[:-1]
+                         "com_apple_xcode_dsym_uuids == %s"%uuid_str]).decode("utf-8")[:-1]
                     if dsym and os.path.exists(dsym):
                         print(('falling back to binary inside "%s"'%dsym))
                         self.symfile = dsym
@@ -764,7 +764,7 @@
                        (datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
         out_file.write(
             'OS Version:      Mac OS X %s (%s)\n' %
-            (platform.mac_ver()[0], subprocess.check_output('sysctl -n kern.osversion', shell=True)))
+            (platform.mac_ver()[0], subprocess.check_output('sysctl -n kern.osversion', shell=True).decode("utf-8")))
         out_file.write('Report Version:  9\n')
         for thread_idx in range(process.num_threads):
             thread = process.thread[thread_idx]


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63311.204775.patch
Type: text/x-patch
Size: 2567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190614/e332600e/attachment.bin>


More information about the llvm-commits mailing list