mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
gh-91952: Make TextIOWrapper.reconfigure() supports "locale" encoding (GH-91982)
This commit is contained in:
parent
b9636180b3
commit
0729b31a8b
4 changed files with 16 additions and 2 deletions
|
|
@ -1248,8 +1248,16 @@ textiowrapper_change_encoding(textio *self, PyObject *encoding,
|
|||
errors = self->errors;
|
||||
}
|
||||
}
|
||||
else if (errors == Py_None) {
|
||||
errors = &_Py_ID(strict);
|
||||
else {
|
||||
if (_PyUnicode_EqualToASCIIString(encoding, "locale")) {
|
||||
encoding = _Py_GetLocaleEncodingObject();
|
||||
if (encoding == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (errors == Py_None) {
|
||||
errors = &_Py_ID(strict);
|
||||
}
|
||||
}
|
||||
|
||||
const char *c_errors = PyUnicode_AsUTF8(errors);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue