mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-42208: Add _locale._get_locale_encoding() (GH-23052)
* Add a new _locale._get_locale_encoding() function to get the current locale encoding. * Modify locale.getpreferredencoding() to use it. * Remove the _bootlocale module.
This commit is contained in:
parent
710e826307
commit
b62bdf71ea
6 changed files with 86 additions and 103 deletions
|
@ -768,9 +768,24 @@ _locale_bind_textdomain_codeset_impl(PyObject *module, const char *domain,
|
|||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
#endif
|
||||
#endif // HAVE_BIND_TEXTDOMAIN_CODESET
|
||||
|
||||
#endif // HAVE_LIBINTL_H
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
_locale._get_locale_encoding
|
||||
|
||||
Get the current locale encoding.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_locale__get_locale_encoding_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=e8e2f6f6f184591a input=513d9961d2f45c76]*/
|
||||
{
|
||||
return _Py_GetLocaleEncoding();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static struct PyMethodDef PyLocale_Methods[] = {
|
||||
_LOCALE_SETLOCALE_METHODDEF
|
||||
|
@ -797,6 +812,7 @@ static struct PyMethodDef PyLocale_Methods[] = {
|
|||
_LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF
|
||||
#endif
|
||||
#endif
|
||||
_LOCALE__GET_LOCALE_ENCODING_METHODDEF
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue