Skip to content

Commit 2de5242

Browse files
committed
[lldb/Test] Decode stdout and stderr in case it contains Unicode.
Lit's to_string will just return the string when it's a `str` instance, which in Python 2 can still contain UTF-8 characters. Differential revision: https://reviews.llvm.org/D76955
1 parent d3fdafa commit 2de5242

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lldb/test/API/lldbtest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ def execute(self, test, litConfig):
110110
timeoutInfo = 'Reached timeout of {} seconds'.format(
111111
litConfig.maxIndividualTestTime)
112112

113+
if sys.version_info.major == 2:
114+
# In Python 2, string objects can contain Unicode characters.
115+
out = out.decode('utf-8')
116+
err = err.decode('utf-8')
117+
113118
output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
114119
' '.join(cmd), exitCode)
115120
if timeoutInfo is not None:

0 commit comments

Comments
 (0)