Update Musl Libc code

We now have implement all of Musl's localization code, the same way that
Musl implements localization. You may need setlocale(LC_ALL, "C.UTF-8"),
just in case anything stops working as expected.
This commit is contained in:
Justine Tunney 2024-07-30 09:14:57 -07:00
parent d0360bf4bd
commit bb815eafaf
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
116 changed files with 6525 additions and 5523 deletions

View file

@ -3158,6 +3158,37 @@ PyUnicode_AsWideCharString(PyObject *unicode,
return buffer;
}
wchar_t*
_PyUnicode_AsWideCharString(PyObject *unicode)
{
const wchar_t *wstr;
wchar_t *buffer;
Py_ssize_t buflen;
if (unicode == NULL) {
PyErr_BadInternalCall();
return NULL;
}
wstr = PyUnicode_AsUnicodeAndSize(unicode, &buflen);
if (wstr == NULL) {
return NULL;
}
if (wcslen(wstr) != (size_t)buflen) {
PyErr_SetString(PyExc_ValueError,
"embedded null character");
return NULL;
}
buffer = PyMem_NEW(wchar_t, buflen + 1);
if (buffer == NULL) {
PyErr_NoMemory();
return NULL;
}
memcpy(buffer, wstr, (buflen + 1) * sizeof(wchar_t));
return buffer;
}
PyObject *
PyUnicode_FromOrdinal(int ordinal)
{