From b6ba10546750a42d3b425c7a5932a4041c4279db Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Mon, 25 Jan 2021 09:00:24 -0600 Subject: [PATCH] [Py3] fix py3 issue in tools Bug: v8:9871 Change-Id: I4084771cfc4d34f8e1b9d5265e115f9eac1098d8 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2646165 Reviewed-by: Dan Elphick Reviewed-by: Michael Achenbach Commit-Queue: Gus Caplan Cr-Commit-Position: refs/heads/master@{#72293} --- tools/gen-v8-gn.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/gen-v8-gn.py b/tools/gen-v8-gn.py index 91f6cf80e3..21d9f3a3a2 100755 --- a/tools/gen-v8-gn.py +++ b/tools/gen-v8-gn.py @@ -5,10 +5,15 @@ # found in the LICENSE file. import argparse -from io import BytesIO import os import sys +if (sys.version_info >= (3, 0)): + from io import StringIO +else: + from io import BytesIO as StringIO + + def parse_args(): global args parser = argparse.ArgumentParser() @@ -60,7 +65,7 @@ def generate_header(out): def main(): parse_args() - header_stream = BytesIO("") + header_stream = StringIO("") generate_header(header_stream) contents = header_stream.getvalue() if args.output: