diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-02-21 03:39:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-21 03:39:30 (GMT) |
commit | d9dce23643c319ff4f721ad65a7f9811e8adfc53 (patch) | |
tree | bf181452280eb643c3d4c0e87f6cafd7a113c277 /Lib/fileinput.py | |
parent | 7bb41d9d5d2f0be30fd367fd085bb307db1a1ca3 (diff) | |
download | cpython-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.py | 2 |
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': |