diff options
author | Inada Naoki <songofacandy@gmail.com> | 2021-03-31 05:26:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-31 05:26:08 (GMT) |
commit | ff3c9739bd69aa8b58007e63c9e40e6708b4761e (patch) | |
tree | 8f2b09f576e0f8ddb79d0a1e412363cff697ced7 /Modules | |
parent | 1b4a9c7956d5dc64f8002f62bf0faae2d1892f90 (diff) | |
download | cpython-ff3c9739bd69aa8b58007e63c9e40e6708b4761e.zip cpython-ff3c9739bd69aa8b58007e63c9e40e6708b4761e.tar.gz cpython-ff3c9739bd69aa8b58007e63c9e40e6708b4761e.tar.bz2 |
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 'Modules')
-rw-r--r-- | Modules/_io/_iomodule.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c index 652c2ce..c627ca2 100644 --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -346,7 +346,8 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode, goto error; } - if (binary && encoding != NULL) { + if (binary && encoding != NULL + && strcmp(encoding, "locale") != 0) { PyErr_SetString(PyExc_ValueError, "binary mode doesn't take an encoding argument"); goto error; |