[Lldb-commits] [PATCH] D131304: [lldb] Remove uses of six module (NFC)

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 5 15:46:17 PDT 2022


kastiglione added inline comments.


================
Comment at: lldb/packages/Python/lldbsuite/support/encoded_file.py:17-25
-def _encoded_read(old_read, encoding):
-    def impl(size):
-        result = old_read(size)
-        # If this is Python 2 then we need to convert the resulting `unicode` back
-        # into a `str` before returning
-        if six.PY2:
-            result = result.encode(encoding)
----------------
this function only deviated in the case of python 2, so I removed it.


================
Comment at: lldb/packages/Python/lldbsuite/support/seven.py:12
-else:
-    def get_command_status_output(command):
-        try:
----------------
this function was not used externally, so I inlined it into `get_command_output`.


================
Comment at: lldb/packages/Python/lldbsuite/support/seven.py:27
-
-    cmp_ = lambda x, y: (x > y) - (x < y)
-
----------------
this was also not used.


================
Comment at: lldb/packages/Python/lldbsuite/test/lldbtest.py:2278-2281
+        assert not isinstance(patterns, str), \
             "patterns must be a collection of strings"
-        assert not isinstance(substrs, six.string_types), \
+        assert not isinstance(substrs, str), \
             "substrs must be a collection of strings"
----------------
this function had a parameter named `str`, which shadowed `builtin.str`. As a fix, in this file I renamed all variables named `str` to `string`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131304/new/

https://reviews.llvm.org/D131304



More information about the lldb-commits mailing list