From ad4a0cc519a5bb14204324e0e32e976318f9e6ce Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 7 Mar 2017 22:24:44 -0800 Subject: 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. --- Modules/_localemodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index f5c126a..ecd673e 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; } -- cgit v0.12