]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix EncodingWarning in Tools/freeze/test/freeze.py (GH-29742)
authorInada Naoki <songofacandy@gmail.com>
Tue, 30 Nov 2021 04:16:40 +0000 (13:16 +0900)
committerGitHub <noreply@github.com>
Tue, 30 Nov 2021 04:16:40 +0000 (13:16 +0900)
Tools/freeze/test/freeze.py

index db2aa3101d87901910c870e3be6fb2e1282ae1c1..abedac03f91b04de8be6a51e327f77b83b5fe588 100644 (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