diff options
author | Zachary Turner <zturner@google.com> | 2016-01-22 23:54:49 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-01-22 23:54:49 +0000 |
commit | 8012496a911ea08e46172b4c3b556761f10ae684 (patch) | |
tree | 633f8860643c55be54ce643f286fc132304ae3c9 /lldb/packages/Python/lldbsuite/test/lldbtest.py | |
parent | 9bd1c596dda85e0997b772241adab342d98dfe81 (diff) | |
download | bcm5719-llvm-8012496a911ea08e46172b4c3b556761f10ae684.tar.gz bcm5719-llvm-8012496a911ea08e46172b4c3b556761f10ae684.zip |
Decode files with UTF-8 in lldbutil.line_number.
Since Unicode support is different in Py2 and Py3, Py3 was throwing
exceptions about being unable to decode the file with the default
encoding.
llvm-svn: 258588
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lldbtest.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/lldbtest.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 63be1809c14..015615bd875 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -41,6 +41,7 @@ from distutils.version import LooseVersion import gc import glob import inspect +import io import os, sys, traceback import os.path import re @@ -201,7 +202,7 @@ def EnvArray(): def line_number(filename, string_to_match): """Helper function to return the line number of the first matched string.""" - with open(filename, 'r') as f: + with io.open(filename, mode='r', encoding="utf-8") as f: for i, line in enumerate(f): if line.find(string_to_match) != -1: # Found our match. |