[PATCH] D34793: [lit] Fix some convoluted logic around Unicode encoding, and de-duplicate across modules that used it.

David L. Jones via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 17:33:32 PDT 2017


dlj created this revision.
Herald added a subscriber: sanjoy.

In Python2 and Python3, the various (non-)?Unicode string types are sort of
spaghetti. Python2 has unicode support tacked on via the 'unicode' type, which
is distinct from 'str' (which are bytes). Python3 takes the "unicode-everywhere"
approach, with 'str' representing a Unicode string.

Both have a 'bytes' type. In Python3, it is the only way to represent raw bytes.
However, in Python2, 'bytes' is an alias for 'str'. This leads to interesting
problems when an interface requires a precise type, but has to run under both
Python2 and Python3.

The previous logic appeared to be correct in all cases, but went through more
layers of indirection than necessary. This change does the necessary conversions
in one shot, with documentation about which paths might be taken in Python2 or
Python3.


https://reviews.llvm.org/D34793

Files:
  utils/lit/lit/formats/googletest.py
  utils/lit/lit/util.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34793.104554.patch
Type: text/x-patch
Size: 6594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170629/1b95c66d/attachment.bin>


More information about the llvm-commits mailing list