This revision was automatically updated to reflect the committed changes.
vsk marked an inline comment as done.
Closed by commit rGf807d0b4acdb: [lldb/test] Fix for flakiness in 
TestNSDictionarySynthetic (authored by vsk).

Changed prior to commit:
  https://reviews.llvm.org/D79645?vs=262927&id=263210#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79645

Files:
  lldb/test/API/lldbtest.py


Index: lldb/test/API/lldbtest.py
===================================================================
--- lldb/test/API/lldbtest.py
+++ lldb/test/API/lldbtest.py
@@ -119,9 +119,14 @@
                 litConfig.maxIndividualTestTime)
 
         if sys.version_info.major == 2:
-            # In Python 2, string objects can contain Unicode characters.
-            out = out.decode('utf-8')
-            err = err.decode('utf-8')
+            # In Python 2, string objects can contain Unicode characters. Use
+            # the non-strict 'replace' decoding mode. We cannot use the strict
+            # mode right now because lldb's StringPrinter facility and the
+            # Python utf8 decoder have different interpretations of which
+            # characters are "printable". This leads to Python utf8 decoding
+            # exceptions even though lldb is behaving as expected.
+            out = out.decode('utf-8', 'replace')
+            err = err.decode('utf-8', 'replace')
 
         output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
             ' '.join(cmd), exitCode)


Index: lldb/test/API/lldbtest.py
===================================================================
--- lldb/test/API/lldbtest.py
+++ lldb/test/API/lldbtest.py
@@ -119,9 +119,14 @@
                 litConfig.maxIndividualTestTime)
 
         if sys.version_info.major == 2:
-            # In Python 2, string objects can contain Unicode characters.
-            out = out.decode('utf-8')
-            err = err.decode('utf-8')
+            # In Python 2, string objects can contain Unicode characters. Use
+            # the non-strict 'replace' decoding mode. We cannot use the strict
+            # mode right now because lldb's StringPrinter facility and the
+            # Python utf8 decoder have different interpretations of which
+            # characters are "printable". This leads to Python utf8 decoding
+            # exceptions even though lldb is behaving as expected.
+            out = out.decode('utf-8', 'replace')
+            err = err.decode('utf-8', 'replace')
 
         output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
             ' '.join(cmd), exitCode)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to