lit/util.py: Another fix for py3.

'str' object has no attribute 'decode'.

llvm-svn: 280641
This commit is contained in:
NAKAMURA Takumi 2016-09-05 00:00:40 +00:00
parent 4127705ad2
commit 4061732e88

View 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)