From: Benjamin Peterson Date: Wed, 8 Mar 2017 06:24:44 +0000 (-0800) Subject: allow the first call to wcsxfrm to return ERANGE (#536) X-Git-Tag: v3.7.0a1~1178 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad4a0cc519a5bb14204324e0e32e976318f9e6ce;p=python allow the first call to wcsxfrm to return ERANGE (#536) If the output buffer provided to wcsxfrm is too small, errno is set to ERANGE. We should not error out in that case. --- diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index f5c126a7a1..ecd673e4a7 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; }