mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-36775: Add _Py_FORCE_UTF8_FS_ENCODING macro (GH-13056)
Add _Py_FORCE_UTF8_LOCALE and _Py_FORCE_UTF8_FS_ENCODING macros to avoid factorize "#if defined(__ANDROID__) || defined(__VXWORKS__)" and "#if defined(__APPLE__)". Cleanup also config_init_fs_encoding().
This commit is contained in:
parent
c4e78b116f
commit
e251095a3f
5 changed files with 49 additions and 58 deletions
|
@ -366,8 +366,7 @@ _Py_CoerceLegacyLocale(int warn)
|
|||
const char *new_locale = setlocale(LC_CTYPE,
|
||||
target->locale_name);
|
||||
if (new_locale != NULL) {
|
||||
#if !defined(__APPLE__) && !defined(__ANDROID__) && \
|
||||
defined(HAVE_LANGINFO_H) && defined(CODESET)
|
||||
#if !defined(_Py_FORCE_UTF8_LOCALE) && defined(HAVE_LANGINFO_H) && defined(CODESET)
|
||||
/* Also ensure that nl_langinfo works in this locale */
|
||||
char *codeset = nl_langinfo(CODESET);
|
||||
if (!codeset || *codeset == '\0') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue