[Lldb-commits] [PATCH] D56517: [Python] Update checkDsymForUUIDIsOn to be compatible with Python 3.

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 9 15:23:50 PST 2019

zturner added a comment.

Another way of dealing with this is to pass `universal_newlines=True` to `subprocess.Popen`.  Despite the silly name, all this really means is "redirected pipes are text mode".  As long as you expect the command being run to always return text rather than binary, it's safe to use.  The name `universal_newlines` is actually so poor that in Python 3.7 they made a new alias that is identical, but just called `text`, so in 3.7 and higher you can just say `text=True`.  We can't do that here because we probably want to support 3.5 and higher, but the point is just that `universal_newlines` isn't really anything fancy, it just means text.

If you do that, then `process.stdout.read()` will just return a string, and you don't need to manually decode it.



More information about the lldb-commits mailing list