Commit 180f017f authored by Vadim Gorbachev's avatar Vadim Gorbachev Committed by Commit Bot

Preparing v8 to use with python3

There are now less that 100 days until the end of life
of Python 2(aka _legacy_ Python) https://pythonclock.org/ .
The code compatibility check for python2 and python3
used the following tools: futurize, flake8

Related tasks:
1. https://github.com/nodejs/node/issues/24512
2. https://github.com/v8/v8/pull/35

Bug: v8:8594
Change-Id: Ia081a158a2b41cd880a5d47bb340f21858340d42
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1864942
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64381}
parent c48096d4
......@@ -66,7 +66,9 @@ class TestSuite(testsuite.TestSuite):
testsource = testsource.replace("$" + key, replacement[key]);
Test(testname, testsource, expectation)
return MkTest
execfile(pathname, {"Test": Test, "Template": Template})
with open(pathname) as f:
text = f.read()
exec(text, {"Test": Test, "Template": Template})
def ListTests(self):
result = []
......
......@@ -24,7 +24,7 @@ def parse(file, seqlen):
r'(:?\.|\()(?P<char>\.|\w)(:?\.|\)), bc = (?P<bc>\w+), .*')
total = 0
bc_cnt = [None] * seqlen
for i in xrange(seqlen):
for i in range(seqlen):
bc_cnt[i] = {}
last = [None] * seqlen
with open(file) as f:
......@@ -32,14 +32,14 @@ def parse(file, seqlen):
while l:
l = l.strip()
if l.startswith("Start bytecode interpreter"):
for i in xrange(seqlen):
for i in range(seqlen):
last[i] = collections.deque(maxlen=i+1)
match = rx.search(l)
if match:
total += 1
bc = match.group('bc')
for i in xrange(seqlen):
for i in range(seqlen):
last[i].append(bc)
key = ' --> '.join(last[i])
bc_cnt[i][key] = bc_cnt[i].get(key,0) + 1
......@@ -57,7 +57,7 @@ def print_most_common(d, seqlen, total):
def main(argv):
max_seq = 7
bc_cnt, total = parse(argv[1],max_seq)
for i in xrange(max_seq):
for i in range(max_seq):
print()
print("Most common of length {}".format(i+1))
print()
......
......@@ -4,6 +4,7 @@
# Use of this source code is governed by a BSD-style license that can be found
# in the LICENSE file.
from __future__ import print_function
import argparse
import io
import sys
......@@ -34,10 +35,10 @@ if __name__ == "__main__":
section_name_bs = fin.read(section_name_length)
if section_name_bs == "compilationHints":
num_hints, bs = read_varuintN(fin)
print "Custom section compilationHints with", num_hints, "hints:"
print("Custom section compilationHints with ", num_hints, "hints:")
for i in range(num_hints):
hint, bs = read_uint8(fin)
print i, hex(hint)
print(i, " ", hex(hint))
else:
remaining_length = payload_length \
- len(section_name_length_bs) \
......
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