Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions Doc/c-api/conversion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,41 @@ The following functions provide locale-independent string to number conversions.
.. c:function:: int PyOS_stricmp(const char *s1, const char *s2)

Case insensitive comparison of strings. The function works almost
identically to :c:func:`!strcmp` except that it ignores the case.
identically to :c:func:`!strcmp` except that it ignores the case and locale.

This is an alias of :c:func:`PyOS_mystricmp` on all platforms except Windows,
where it is an alias of :c:func:`!strcmp`.


.. c:function:: int PyOS_strnicmp(const char *s1, const char *s2, Py_ssize_t size)

Case insensitive comparison of strings. The function works almost
identically to :c:func:`!strncmp` except that it ignores the case.
identically to :c:func:`!strncmp` except that it ignores the case and locale.

This is an alias of :c:func:`PyOS_mystricmp` on all platforms except Windows,
where it is an alias of :c:func:`!strncmp`.


.. c:function:: int PyOS_mystricmp(const char *str1, const char *str2)

Case insensitive comparison of strings. The function works almost
identically to :c:func:`!strcmp` except that it ignores the case and locale.

Return ``0`` if the strings are equal, a negative value if *str1* is less
than *str2*, or a positive value if *str1* is greater than *str2*.

This function cannot fail.


.. c:function:: int PyOS_mystrnicmp(const char *str1, const char *str2, Py_ssize_t size)

Case insensitive comparison of strings. The function works almost
identically to :c:func:`!strncmp` except that it ignores the case and locale.

Return ``0`` if the strings are equal, a negative value if *str1* is less
than *str2*, or a positive value if *str1* is greater than *str2*.

This function cannot fail.


Character classification and conversion
Expand Down
4 changes: 2 additions & 2 deletions Misc/NEWS.d/3.10.0a1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3275,8 +3275,8 @@ Types created with :c:func:`PyType_FromSpec` now make any signature in their
.. nonce: u6Xfr2
.. section: C API

Fix bug in PyOS_mystrnicmp and PyOS_mystricmp that incremented pointers
beyond the end of a string.
Fix bug in :c:func:`PyOS_mystrnicmp` and :c:func:`PyOS_mystricmp` that
incremented pointers beyond the end of a string.

..

Expand Down
Loading