summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2021-09-30 03:36:16 (GMT)
committerGitHub <noreply@github.com>2021-09-30 03:36:16 (GMT)
commita1437170039dc2c07e6040d3a8ba8d91434b730d (patch)
tree7299776cac622d04695d3eac95b35a7d2571a64f /Tools
parent0231b6da45b610d33ee4e99bf190e31488d6ab26 (diff)
downloadcpython-a1437170039dc2c07e6040d3a8ba8d91434b730d.zip
cpython-a1437170039dc2c07e6040d3a8ba8d91434b730d.tar.gz
cpython-a1437170039dc2c07e6040d3a8ba8d91434b730d.tar.bz2
Fix EncodingWarning in freeze_modules. (GH-28591)
Diffstat (limited to 'Tools')
-rw-r--r--Tools/scripts/freeze_modules.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Tools/scripts/freeze_modules.py b/Tools/scripts/freeze_modules.py
index f727391..ea96253 100644
--- a/Tools/scripts/freeze_modules.py
+++ b/Tools/scripts/freeze_modules.py
@@ -329,10 +329,10 @@ def _iter_sources(modules):
# generic helpers
def _get_checksum(filename):
- with open(filename) as infile:
- text = infile.read()
+ with open(filename, "rb") as infile:
+ contents = infile.read()
m = hashlib.sha256()
- m.update(text.encode('utf8'))
+ m.update(contents)
return m.hexdigest()
@@ -489,7 +489,7 @@ def regen_manifest(modules):
modlines.append(' '.join(row).rstrip())
print(f'# Updating {os.path.relpath(MANIFEST)}')
- with open(MANIFEST, 'w') as outfile:
+ with open(MANIFEST, 'w', encoding="utf-8") as outfile:
lines = (l + '\n' for l in modlines)
outfile.writelines(lines)