Skip to content

locale.strxfrm() can fail on FreeBSD #149603

@inof

Description

@inof

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions