[PATCH] D46773: [lit] Fix several tests that fail when using Python 3 or on Windows

Stella Stamenova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 14 12:55:58 PDT 2018


stella.stamenova added inline comments.


================
Comment at: packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py:281-285
+                # In Python 2, sockets return byte strings. In Python 3, sockets return bytes.
+                # If we got bytes (and not a byte string), decode them to a string for later handling.
+                if isinstance(data, bytes) and not isinstance(data, str):
+                    data = data.decode()
+                self._receive(data)
----------------
zturner wrote:
> It's a shame that we're not using lit here.  lit has a nice function `lit.util.to_string` which handles this (and one other strange edge case) correctly.
I looked into using it - but currently none of the lldb tests use functionality from lit and I don't think there's a good way to do so. Let me know if you have a suggestion, but otherwise, I think this is the least impactful change that fixes the tests.


Repository:
  rL LLVM

https://reviews.llvm.org/D46773





More information about the llvm-commits mailing list