summaryrefslogtreecommitdiffstats
path: root/Lib/fileinput.py
diff options
context:
space:
mode:
authorGihwan Kim <ghkim3221@gmail.com>2023-02-21 03:10:29 (GMT)
committerGitHub <noreply@github.com>2023-02-21 03:10:29 (GMT)
commit6f25657b83d7a680a97849490f6e973b3a695e1a (patch)
treee662164741282f67df22c1eadff0c1665ac384ea /Lib/fileinput.py
parent022b44f2546c44183e4df7b67e3e64502fae9143 (diff)
downloadcpython-6f25657b83d7a680a97849490f6e973b3a695e1a.zip
cpython-6f25657b83d7a680a97849490f6e973b3a695e1a.tar.gz
cpython-6f25657b83d7a680a97849490f6e973b3a695e1a.tar.bz2
gh-101961 fileinput.hookcompressed should not set the encoding value for the binary mode (gh-102068)
Diffstat (limited to 'Lib/fileinput.py')
-rw-r--r--Lib/fileinput.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py
index e234dc9..1b25f28 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -399,7 +399,7 @@ class FileInput:
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':