This patch fixes limitation in python which expects strxfrm function to return string with characters with values lower than 10ffff. This is known issue: https://github.com/python/cpython/pull/138448 --- Python-3.14.0/Modules/_localemodule.c.orig +++ Python-3.14.0/Modules/_localemodule.c @@ -395,7 +395,7 @@ /*[clinic end generated code: output=3081866ebffc01af input=1378bbe6a88b4780]*/ { Py_ssize_t n1; - wchar_t *s = NULL, *buf = NULL; + wchar_t *s = NULL, *buf = NULL, *solbuf = NULL; size_t n2; PyObject *result = NULL; @@ -436,8 +436,24 @@ goto exit; } } - result = PyUnicode_FromWideChar(buf, n2); + + /* Split each character in resulting wide string in two + parts in order to prevent Python ValueErrors on Solaris. */ + solbuf = PyMem_New(wchar_t, (n2*2) + 1); + if (!solbuf) { + PyErr_NoMemory(); + goto exit; + } + unsigned int i, j; + for (i = 0, j = 0; i < n2; i ++, j+= 2) { + solbuf[j] = 0x10000 + (buf[i] >> 16); + solbuf[j+1] = buf[i] & 0xffff; + } + solbuf[j] = 0; + + result = PyUnicode_FromWideChar(solbuf, n2*2); exit: + PyMem_Free(solbuf); PyMem_Free(buf); PyMem_Free(s); return result;