From 671e6340da589fe94d30fa97fb3c89318881a775 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Wed, 27 Jan 2016 19:00:51 +0000 Subject: Resubmit r258759 with proper unicode handling. Instead of opening the file in unicode mode, we need only encode data which potentially has non-ASCII characters as UTF8 before writing. This should work across both Python versions, and is also far simpler than anything else discussed. llvm-svn: 258969 --- lldb/packages/Python/lldbsuite/test/lldbtest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lldb/packages/Python/lldbsuite/test/lldbtest.py') diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 61355a86129..e5fdd6e6faf 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -262,7 +262,7 @@ class recording(SixStringIO): if self.trace: print(self.getvalue(), file=sys.stderr) if self.session: - print(self.getvalue(), file=self.session) + print(self.getvalue().encode(), file=self.session) self.close() @add_metaclass(abc.ABCMeta) @@ -1843,7 +1843,7 @@ class Base(unittest2.TestCase): if not self.__unexpected__ and not self.__skipped__: for test, traceback in pairs: if test is self: - print(traceback, file=self.session) + print(traceback.encode(), file=self.session) # put footer (timestamp/rerun instructions) into session testMethod = getattr(self, self._testMethodName) -- cgit v1.2.3