Commit 9ebd7612 authored by Raul Tambre's avatar Raul Tambre Committed by Commit Bot

Support Python 3 in //tools/js2c.py

The script still works with Python 2.
There are no intended behaviour changes.

Bug: chromium:941669
Change-Id: I5ec63564fdb29a326c64d6ac7465f86b30ef16c1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1585857Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
Cr-Commit-Position: refs/heads/master@{#61191}
parent e4d48215
......@@ -148,6 +148,7 @@ PhistucK <phistuck@gmail.com>
Qingyan Li <qingyan.liqy@alibaba-inc.com>
Qiuyi Zhang <qiuyi.zqy@alibaba-inc.com>
Rafal Krypa <rafal@krypa.net>
Raul Tambre <raul@tambre.ee>
Ray Glover <ray@rayglover.net>
Refael Ackermann <refack@gmail.com>
Rene Rebe <rene@exactcode.de>
......
......@@ -245,7 +245,10 @@ def BuildMetadata(sources, source_bytes, native_type):
raw_sources = "".join(sources.modules)
# The sources are expected to be ASCII-only.
assert not filter(lambda value: ord(value) >= 128, raw_sources)
try:
raw_sources.encode('ascii')
except UnicodeEncodeError:
assert False
# Loop over modules and build up indices into the source blob:
get_index_cases = []
......@@ -300,8 +303,8 @@ def PutInt(blob_file, value):
def PutStr(blob_file, value):
PutInt(blob_file, len(value));
blob_file.write(value);
PutInt(blob_file, len(value.encode()))
blob_file.write(value.encode())
def WriteStartupBlob(sources, startup_blob):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment