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

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.
(cherry picked from commit d0c9353a79)

Co-authored-by: Victor Stinner <vstinner@python.org>

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2022-05-11 17:01:35 -07:00 committed by GitHub
parent a1bef8c2e3
commit 6e1a214426
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