[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
Author: davide
Date: Thu Mar 7 09:45:53 2019
New Revision: 355612
URL: http://llvm.org/viewvc/llvm-project?rev=355612&view=rev
Log:
[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.
Modified:
lldb/trunk/packages/Python/lldbsuite/support/encoded_file.py
Modified: lldb/trunk/packages/Python/lldbsuite/support/encoded_file.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/support/encoded_file.py?rev=355612&r1=355611&r2=355612&view=diff
==============================================================================
--- 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)
return old_write(s)
return impl
More information about the lldb-commits
mailing list