lit/util.py: Another fix for py3.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Mon, 5 Sep 2016 00:00:40 +0000 (00:00 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Mon, 5 Sep 2016 00:00:40 +0000 (00:00 +0000)
  'str' object has no attribute 'decode'.

llvm-svn: 280641

llvm/utils/lit/lit/util.py

index 79eedfa..d3187e3 100644 (file)
@@ -20,6 +20,8 @@ def to_string(bytes):
 def convert_string(bytes):
     try:
         return to_string(bytes.decode('utf-8'))
+    except AttributeError: # 'str' object has no attribute 'decode'.
+        return str(bytes)
     except UnicodeError:
         return str(bytes)