[Python-checkins] bpo-43651: Fix EncodingWarning in lib2to3/pgen2/pgen.py (GH-25127)

methane webhook-mailer at python.org
Thu Apr 1 19:59:22 EDT 2021


https://github.com/python/cpython/commit/c0ec4486dc7dd70fea39d1473ac9a9ac568378fe
commit: c0ec4486dc7dd70fea39d1473ac9a9ac568378fe
branch: master
author: Inada Naoki <songofacandy at gmail.com>
committer: methane <songofacandy at gmail.com>
date: 2021-04-02T08:59:15+09:00
summary:

bpo-43651: Fix EncodingWarning in lib2to3/pgen2/pgen.py (GH-25127)

files:
M Lib/lib2to3/pgen2/pgen.py

diff --git a/Lib/lib2to3/pgen2/pgen.py b/Lib/lib2to3/pgen2/pgen.py
index b0cbd16c4dad4..7abd5cef1c36b 100644
--- a/Lib/lib2to3/pgen2/pgen.py
+++ b/Lib/lib2to3/pgen2/pgen.py
@@ -12,7 +12,7 @@ class ParserGenerator(object):
     def __init__(self, filename, stream=None):
         close_stream = None
         if stream is None:
-            stream = open(filename)
+            stream = open(filename, encoding="utf-8")
             close_stream = stream.close
         self.filename = filename
         self.stream = stream



More information about the Python-checkins mailing list