summaryrefslogtreecommitdiffstats
path: root/Lib/fileinput.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-02-21 03:39:30 (GMT)
committerGitHub <noreply@github.com>2023-02-21 03:39:30 (GMT)
commitd9dce23643c319ff4f721ad65a7f9811e8adfc53 (patch)
treebf181452280eb643c3d4c0e87f6cafd7a113c277 /Lib/fileinput.py
parent7bb41d9d5d2f0be30fd367fd085bb307db1a1ca3 (diff)
downloadcpython-d9dce23643c319ff4f721ad65a7f9811e8adfc53.zip
cpython-d9dce23643c319ff4f721ad65a7f9811e8adfc53.tar.gz
cpython-d9dce23643c319ff4f721ad65a7f9811e8adfc53.tar.bz2
[3.10] gh-101961 fileinput.hookcompressed should not set the encoding value for the binary mode (gh-102068) (#102099)
gh-101961 fileinput.hookcompressed should not set the encoding value for the binary mode (gh-102068) (cherry picked from commit 6f25657b83d7a680a97849490f6e973b3a695e1a) Co-authored-by: Gihwan Kim <gihwan.kim@linecorp.com>
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 2ce2f91..3bd1990 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -419,7 +419,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':