gh-89653: PEP 670: unicodeobject.h uses _Py_CAST() (#92696)

Use _Py_CAST() and _Py_STATIC_CAST() in macros wrapping static inline
functions of unicodeobject.h.

Change also the kind type from unsigned int to int: same parameter
type than PyUnicode_FromKindAndData().

The limited API version 3.11 no longer casts arguments to expected
types.
This commit is contained in:
Victor Stinner 2022-05-12 01:35:41 +02:00 committed by GitHub
parent 92f0ed1d90
commit d0c9353a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 9 deletions

View file

@ -149,7 +149,7 @@ access to internal read-only data of Unicode objects:
``PyUnicode_WCHAR_KIND`` is deprecated.
.. c:function:: unsigned int PyUnicode_KIND(PyObject *o)
.. c:function:: int PyUnicode_KIND(PyObject *o)
Return one of the PyUnicode kind constants (see above) that indicate how many
bytes per character this Unicode object uses to store its data. *o* has to
@ -168,7 +168,7 @@ access to internal read-only data of Unicode objects:
.. versionadded:: 3.3
.. c:function:: void PyUnicode_WRITE(unsigned int kind, void *data, \
.. c:function:: void PyUnicode_WRITE(int kind, void *data, \
Py_ssize_t index, Py_UCS4 value)
Write into a canonical representation *data* (as obtained with
@ -181,7 +181,7 @@ access to internal read-only data of Unicode objects:
.. versionadded:: 3.3
.. c:function:: Py_UCS4 PyUnicode_READ(unsigned int kind, void *data, \
.. c:function:: Py_UCS4 PyUnicode_READ(int kind, void *data, \
Py_ssize_t index)
Read a code point from a canonical representation *data* (as obtained with