diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index f5c126a7a1463e..ecd673e4a7dbad 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -262,7 +262,7 @@ PyLocale_strxfrm(PyObject* self, PyObject* args) } errno = 0; n2 = wcsxfrm(buf, s, n1); - if (errno) { + if (errno && errno != ERANGE) { PyErr_SetFromErrno(PyExc_OSError); goto exit; }