Documentation
The page at https://docs.python.org/3/library/locale.html should mention that locale.strxfrm() can raise OSError.
Minimum example to reproduce it:
>>> from locale import *
>>> setlocale(LC_COLLATE, 'de_DE.UTF-8')
'de_DE.UTF-8'
>>> strxfrm(chr(197))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument
I guess that the strxfrm() function of the underlying OS is used, so the behavior might depend on that. In my case it is FreeBSD 14. However, the manual page strxfrm(3) on FreeBSD does not mention that the function might fail.
Documentation
The page at https://docs.python.org/3/library/locale.html should mention that
locale.strxfrm()can raiseOSError.Minimum example to reproduce it:
>>> from locale import *>>> setlocale(LC_COLLATE, 'de_DE.UTF-8')'de_DE.UTF-8'>>> strxfrm(chr(197))Traceback (most recent call last):File "<stdin>", line 1, in <module>OSError: [Errno 22] Invalid argumentI guess that the strxfrm() function of the underlying OS is used, so the behavior might depend on that. In my case it is FreeBSD 14. However, the manual page
strxfrm(3)on FreeBSD does not mention that the function might fail.