diff options
author | Inada Naoki <songofacandy@gmail.com> | 2021-03-31 14:26:08 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-31 14:26:08 +0900 |
commit | ff3c9739bd69aa8b58007e63c9e40e6708b4761e (patch) | |
tree | 8f2b09f576e0f8ddb79d0a1e412363cff697ced7 /Lib/_pyio.py | |
parent | 1b4a9c7956d5dc64f8002f62bf0faae2d1892f90 (diff) | |
download | cpython-git-ff3c9739bd69aa8b58007e63c9e40e6708b4761e.tar.gz |
bpo-43510: PEP 597: Accept `encoding="locale"` in binary mode (GH-25103)
It make `encoding="locale"` usable everywhere `encoding=None` is
allowed.
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 0f182d4240..ba0b0a29b5 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -221,7 +221,7 @@ def open(file, mode="r", buffering=-1, encoding=None, errors=None, raise ValueError("can't have read/write/append mode at once") if not (creating or reading or writing or appending): raise ValueError("must have exactly one of read/write/append mode") - if binary and encoding is not None: + if binary and encoding is not None and encoding != "locale": raise ValueError("binary mode doesn't take an encoding argument") if binary and errors is not None: raise ValueError("binary mode doesn't take an errors argument") |