gh-89653: PEP 670: Convert PyUnicode_KIND() macro to function (#92705)

In the limited C API version 3.12, PyUnicode_KIND() is now
implemented as a static inline function. Keep the macro for the
regular C API and for the limited C API version 3.11 and older to
prevent introducing new compiler warnings.

Update _decimal.c and stringlib/eq.h for PyUnicode_KIND().
This commit is contained in:
Victor Stinner 2022-05-13 11:49:56 +02:00 committed by GitHub
parent d81d57e959
commit db388df1d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 10 deletions

View file

@ -6,9 +6,6 @@
Py_LOCAL_INLINE(int)
unicode_eq(PyObject *a, PyObject *b)
{
assert(PyUnicode_Check(a));
assert(PyUnicode_Check(b));
if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b))
return 0;
if (PyUnicode_GET_LENGTH(a) == 0)