mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
bpo-43510: PEP 597: Accept encoding="locale"
in binary mode (GH-25103)
It make `encoding="locale"` usable everywhere `encoding=None` is allowed.
This commit is contained in:
parent
1b4a9c7956
commit
ff3c9739bd
3 changed files with 14 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue