Skip to content

Commit a143717

Browse files
authored
Fix EncodingWarning in freeze_modules. (GH-28591)
1 parent 0231b6d commit a143717

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Tools/scripts/freeze_modules.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,10 @@ def _iter_sources(modules):
329329
# generic helpers
330330

331331
def _get_checksum(filename):
332-
with open(filename) as infile:
333-
text = infile.read()
332+
with open(filename, "rb") as infile:
333+
contents = infile.read()
334334
m = hashlib.sha256()
335-
m.update(text.encode('utf8'))
335+
m.update(contents)
336336
return m.hexdigest()
337337

338338

@@ -489,7 +489,7 @@ def regen_manifest(modules):
489489
modlines.append(' '.join(row).rstrip())
490490

491491
print(f'# Updating {os.path.relpath(MANIFEST)}')
492-
with open(MANIFEST, 'w') as outfile:
492+
with open(MANIFEST, 'w', encoding="utf-8") as outfile:
493493
lines = (l + '\n' for l in modlines)
494494
outfile.writelines(lines)
495495

0 commit comments

Comments
 (0)