Fix EncodingWarning in Tools/freeze/test/freeze.py (GH-29742)

This commit is contained in:
Inada Naoki 2021-11-30 13:16:40 +09:00 committed by GitHub
parent bd9342ddde
commit 9a5dec4e97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -89,7 +89,7 @@ def get_makefile_var(builddir, name):
regex = re.compile(rf'^{name} *=\s*(.*?)\s*$')
filename = os.path.join(builddir, 'Makefile')
try:
infile = open(filename)
infile = open(filename, encoding='utf-8')
except FileNotFoundError:
return None
with infile:
@ -125,7 +125,7 @@ def prepare(script=None, outdir=None):
if script:
scriptfile = os.path.join(outdir, 'app.py')
print(f'creating the script to be frozen at {scriptfile}')
with open(scriptfile, 'w') as outfile:
with open(scriptfile, 'w', encoding='utf-8') as outfile:
outfile.write(script)
# Make a copy of the repo to avoid affecting the current build