summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lldbtest.py
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-01-22 23:54:49 +0000
committerZachary Turner <zturner@google.com>2016-01-22 23:54:49 +0000
commit8012496a911ea08e46172b4c3b556761f10ae684 (patch)
tree633f8860643c55be54ce643f286fc132304ae3c9 /lldb/packages/Python/lldbsuite/test/lldbtest.py
parent9bd1c596dda85e0997b772241adab342d98dfe81 (diff)
downloadbcm5719-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.py3
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.
OpenPOWER on IntegriCloud