Avoid EncodingWarning in blib2to3 (#3696)

This commit is contained in:
Jason R. Coombs 2023-05-19 13:00:29 -04:00 committed by GitHub
parent 2fd9d8b339
commit eedfc38322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,6 @@ class PgenGrammar(grammar.Grammar):
class ParserGenerator(object):
filename: Path
stream: IO[Text]
generator: Iterator[GoodTokenInfo]
@ -39,7 +38,7 @@ class ParserGenerator(object):
def __init__(self, filename: Path, stream: Optional[IO[Text]] = None) -> 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