[Lldb-commits] [lldb] r252381 - Python 3 - Don't use unbuffered I/O in text mode.

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 9 12:56:09 PST 2015


The reason you probably want this unbuffered is for cases where you crash.
When a dotest.py process crashes, the buffered content won't necessarily
get flushed.  So the session file may or may not contain the last thing
that happened in that case.

I think we want it unbuffered where we can.

-Todd

On Fri, Nov 6, 2015 at 5:08 PM, Zachary Turner via lldb-commits <
lldb-commits at lists.llvm.org> wrote:

> Author: zturner
> Date: Fri Nov  6 19:08:15 2015
> New Revision: 252381
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252381&view=rev
> Log:
> Python 3 - Don't use unbuffered I/O in text mode.
>
> This is unsupported in Python 3.  This could also have been fixed
> by using "wb" instead of "w", but it doesn't seem like writing the
> session log absolutely *needs* to be unbuffered.
>
> Modified:
>     lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
>
> Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=252381&r1=252380&r2=252381&view=diff
>
> ==============================================================================
> --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Nov  6
> 19:08:15 2015
> @@ -1413,8 +1413,8 @@ class Base(unittest2.TestCase):
>          self.log_basename = self.getLogBasenameForCurrentTest()
>
>          session_file = "{}.log".format(self.log_basename)
> -        unbuffered = 0 # 0 is the constant for unbuffered
> -        self.session = open(session_file, "w", unbuffered)
> +        # Python 3 doesn't support unbuffered I/O in text mode.  Open
> buffered.
> +        self.session = open(session_file, "w")
>
>          # Optimistically set __errored__, __failed__, __expected__ to
> False
>          # initially.  If the test errored/failed, the session info
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>



-- 
-Todd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151109/8d87be3d/attachment.html>


More information about the lldb-commits mailing list