SIGN IN SIGN UP

gh-130567: Remove optimistic allocation in locale.strxfrm() (GH-137143)

On modern systems, the result of wcsxfrm() is much larger the size of
the input string (from 4+2*n on Windows to 4+5*n on Linux for simple
ASCII strings), so optimistic allocation of the buffer of the same size
never works.

The exception is if the locale is "C" (or unset), but in that case the `wcsxfrm`
call should be fast (and calling `locale.strxfrm()` doesn't make too much
sense in the first place).
S
Serhiy Storchaka committed
2a2bc82cef9c6ae0b8de833e2b4aee37519de9d7
Parent: 3a81313
Committed by GitHub <noreply@github.com> on 10/16/2025, 7:54:41 AM