[Lldb-commits] [lldb] r252126 - Python 3 - Use universal_newlines=True in subprocess.Popen.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 4 17:33:44 PST 2015


Author: zturner
Date: Wed Nov  4 19:33:44 2015
New Revision: 252126

URL: http://llvm.org/viewvc/llvm-project?rev=252126&view=rev
Log:
Python 3 - Use universal_newlines=True in subprocess.Popen.

This follows the spirit of a previous patch which did essentially
the same thing.  In Python 3, when you use Popen.communicate(),
you get back a bytes object which cannot normally be treated as
a string.  We could decode this manually, but universal_newlines=True
does this automatically, and there's no disadvantage to doing so
even on Python 2.  So just enable it always.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/test_runner/lib/process_control.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/test_runner/lib/process_control.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/test_runner/lib/process_control.py?rev=252126&r1=252125&r2=252126&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/test_runner/lib/process_control.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/test_runner/lib/process_control.py Wed Nov  4 19:33:44 2015
@@ -271,6 +271,7 @@ class UnixProcessHelper(ProcessHelper):
             stdin=subprocess.PIPE,
             stdout=subprocess.PIPE,
             stderr=subprocess.PIPE,
+            universal_newlines=True, # Elicits automatic byte -> string decoding in Py3
             close_fds=True,
             preexec_fn=preexec_func)
 
@@ -383,6 +384,7 @@ class WindowsProcessHelper(ProcessHelper
             stdin=subprocess.PIPE,
             stdout=subprocess.PIPE,
             stderr=subprocess.PIPE,
+            universal_newlines=True, # Elicits automatic byte -> string decoding in Py3
             creationflags=creation_flags)
 
     def was_hard_terminate(self, returncode):




More information about the lldb-commits mailing list