Skip to content

Commit

Permalink
tools: fix mixup with bytes.decode() and str.encode()
Browse files Browse the repository at this point in the history
We want to read a bytes file and decode the contents as utf-8 so we can compare against a utf-8 pattern.
  • Loading branch information
cclauss committed Aug 20, 2019
1 parent edc83a9 commit 4816f7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/v8_gypfiles/GN-scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
def DoMain(args):
gn_filename, pattern = args
src_root = os.path.dirname(gn_filename)
with open(gn_filename, 'r') as gn_file:
gn_content = gn_file.read().encode('utf-8')
with open(gn_filename, 'rb') as gn_file:
gn_content = gn_file.read().decode('utf-8')

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

0 comments on commit 4816f7c

Please sign in to comment.