[Lldb-commits] [PATCH] D16680: Re-submit rL258759: Write the session log file in UTF-8.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 28 11:17:02 PST 2016


I think I have a good idea how to fix this.  in lldbsuite.support we can
add unicode_file.py.  Make it implement the file interface so that it looks
just like an io object so it can be used with print(file=), and with the
'with' keyword, etc.  Make the open method call io.open() with an encoding,
then make the read / write methods do a python version check before sending
the read / write call to the underlying io object.  Then you basically just
do

self.session_file = unicode_file.open(path, mode='w', encoding='utf-8')

and then you can write however you want.

print(u"", self.session_file)
print("", self.session_file)

will both work in any python version

On Thu, Jan 28, 2016 at 10:21 AM Tamas Berghammer <tberghammer at google.com>
wrote:

> tberghammer added a comment.
>
> The traceback calculation is done inside unittest2 so I think we shouldn't
> change it and we don't have access to the session variable either.
>
>
> http://reviews.llvm.org/D16680
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160128/a8a83e06/attachment.html>


More information about the lldb-commits mailing list