Skip to content

Commit

Permalink
lit/util.py: Another fix for py3.
Browse files Browse the repository at this point in the history
  'str' object has no attribute 'decode'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280641 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chapuni committed Sep 5, 2016
1 parent 7ae81d5 commit 2b9ec08
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utils/lit/lit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 2b9ec08

Please sign in to comment.