Skip to content
Snippets Groups Projects
Commit a8921fca authored by Mike Frysinger's avatar Mike Frysinger Committed by Dirk Pranke
Browse files

fix encoding issues with inputs for better Python 3 support

When running subprocesses like '!<(which foo)', we return subprocess's
stdout contents as bytes, not as a string.  Make sure we decode it into
UTF-8 first.

When reading gyp files, we don't specify an encoding, so the default
might be ASCII which breaks when the gyp files contain UTF-8.  Change
it to always read it as a binary stream before decoding to UTF-8.

With those fixes in place, we need to rework all the type checks for
strings & numbers.  Introduce some aliases to the right set of types
for the active version of Python, and then change all the type checks
to use isinstance.

Bug: 926296
Test: building CrOS gyp packages with python3 works again
Test: `./gyptest.py -a` mostly passes (4 failures look toolchain related)
Change-Id: I416acf140d01948748f5cc09e966b52f166b82d0
Reviewed-on: https://chromium-review.googlesource.com/c/external/gyp/+/1697943


Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
parent 12ef00df
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment