[Lldb-commits] [lldb] r355612 - [testsuite] Drop characters that can't be decoded, restoring parity with Py2.
Davide Italiano via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 7 09:45:53 PST 2019
Date: Thu Mar 7 09:45:53 2019
New Revision: 355612
[testsuite] Drop characters that can't be decoded, restoring parity with Py2.
Tests that check the output of `memory find` may trip over
unreadable characters, and in Python 3 this is an error.
--- lldb/trunk/packages/Python/lldbsuite/support/encoded_file.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/support/encoded_file.py Thu Mar 7 09:45:53 2019
@@ -31,6 +31,9 @@ def _encoded_write(old_write, encoding):
# as unicode before attempting to write.
if isinstance(s, six.binary_type):
s = s.decode(encoding, "replace")
+ # Filter unreadable characters, Python 3 is stricter than python 2 about them.
+ import re
+ s = re.sub(r'[^\x00-\x7f]',r' ',s)
More information about the lldb-commits