gh-101961 fileinput.hookcompressed should not set the encoding value for the binary mode (gh-102068)

This commit is contained in:
Gihwan Kim 2023-02-21 12:10:29 +09:00 committed by GitHub
parent 022b44f254
commit 6f25657b83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 12 deletions

View file

@ -399,7 +399,7 @@ def isstdin(self):
def hook_compressed(filename, mode, *, encoding=None, errors=None):
if encoding is None: # EncodingWarning is emitted in FileInput() already.
if encoding is None and "b" not in mode: # EncodingWarning is emitted in FileInput() already.
encoding = "locale"
ext = os.path.splitext(filename)[1]
if ext == '.gz':