mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.11] gh-101961 fileinput.hookcompressed should not set the encoding value for the binary mode (gh-102068) (#102098)
gh-101961 fileinput.hookcompressed should not set the encoding value for the binary mode (gh-102068)
(cherry picked from commit 6f25657b83
)
Co-authored-by: Gihwan Kim <gihwan.kim@linecorp.com>
This commit is contained in:
parent
e9103e69cd
commit
5bc6927c68
4 changed files with 32 additions and 12 deletions
|
@ -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':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue