summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2019-03-07 17:45:53 +0000
committerDavide Italiano <davide@freebsd.org>2019-03-07 17:45:53 +0000
commitbd53e768d22c2c0e329bc08b2002ebd1d74ffaa6 (patch)
treed3a903b3bebf47729b2b83fb7da560b4eb67b9b2 /lldb/packages/Python
parent8a4efd215385d6354f538626ce05fee96dcccb7e (diff)
downloadbcm5719-llvm-bd53e768d22c2c0e329bc08b2002ebd1d74ffaa6.tar.gz
bcm5719-llvm-bd53e768d22c2c0e329bc08b2002ebd1d74ffaa6.zip
[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. llvm-svn: 355612
Diffstat (limited to 'lldb/packages/Python')
-rw-r--r--lldb/packages/Python/lldbsuite/support/encoded_file.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/support/encoded_file.py b/lldb/packages/Python/lldbsuite/support/encoded_file.py
index 1b4c7a2e48d..c233e046ba7 100644
--- a/lldb/packages/Python/lldbsuite/support/encoded_file.py
+++ b/lldb/packages/Python/lldbsuite/support/encoded_file.py
@@ -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
OpenPOWER on IntegriCloud