Bug report
Bug description:
When building on a platform that is not Windows and HAVE_LANGINFO_H is not defined, building can fail because _Py_GetLocaleEncoding attempts to use nl_langinfo regardless:
|
#ifdef MS_WINDOWS |
|
wchar_t encoding[23]; |
|
unsigned int ansi_codepage = GetACP(); |
|
swprintf(encoding, Py_ARRAY_LENGTH(encoding), L"cp%u", ansi_codepage); |
|
encoding[Py_ARRAY_LENGTH(encoding) - 1] = 0; |
|
return _PyMem_RawWcsdup(encoding); |
|
#else |
|
const char *encoding = nl_langinfo(CODESET); |
|
if (!encoding || encoding[0] == '\0') { |
|
// Use UTF-8 if nl_langinfo() returns an empty string. It can happen on |
|
// macOS if the LC_CTYPE locale is not supported. |
|
return _PyMem_RawWcsdup(L"utf-8"); |
|
} |
Maybe if there's no other way to tell it can just default to UTF-8 like Android or etc.
CPython versions tested on:
3.14
Operating systems tested on:
Other
Bug report
Bug description:
When building on a platform that is not Windows and
HAVE_LANGINFO_His not defined, building can fail because_Py_GetLocaleEncodingattempts to usenl_langinforegardless:cpython/Python/fileutils.c
Lines 906 to 918 in 7241f27
Maybe if there's no other way to tell it can just default to UTF-8 like Android or etc.
CPython versions tested on:
3.14
Operating systems tested on:
Other