Skip to content

Commit 6afd1a3

Browse files
cclaussTrott
authored andcommitted
tools: fix mixup with bytes.decode() and str.encode()
We want to read a bytes file and decode the contents as utf-8 so we can compare against a utf-8 pattern. PR-URL: #29208 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent f0c8898 commit 6afd1a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/v8_gypfiles/GN-scraper.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
def DoMain(args):
88
gn_filename, pattern = args
99
src_root = os.path.dirname(gn_filename)
10-
with open(gn_filename, 'r') as gn_file:
11-
gn_content = gn_file.read().encode('utf-8')
10+
with open(gn_filename, 'rb') as gn_file:
11+
gn_content = gn_file.read().decode('utf-8')
1212

1313
scraper_re = re.compile(pattern + r'\[([^\]]+)', re.DOTALL)
1414
matches = scraper_re.search(gn_content)

0 commit comments

Comments
 (0)