[PATCH] D56754: Add Support for Creating and Deleting Unicode Files and Directories in Lit

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 21 17:30:16 PST 2019


efriedma added inline comments.


================
Comment at: utils/lit/lit/util.py:440
+            # converted to UTF-16
+            return text.decode('utf-8') if isinstance(text, bytes) else text
+
----------------
The inner "if" is redundant; on Python2, `bytes` is an alias for `str`, so both sides have the same meaning.

This function seems dangerous in the sense that it isn't clear what type of data it's expecting as input. Probably you should have separate functions for each of the possible cases: input is `bytes`, input is `str`, or input is Python2 `unicode`/Python3 `str`.  (Not sure which of those you actually need, but those are the reasonable possibilities, I think.)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56754





More information about the llvm-commits mailing list