bpo-45490: Convert unicodeobject.h macros to static inline functions by vstinner · Pull Request #31221 · python/cpython (original) (raw)

The SC asked to not add such macro :-) You're right that without such macro, there is a risk of introducing new compiler warnings.

If possible I would prefer to keep PyObject* for functions in unicodeobject.c, since it's the type used for arguments in existing functions and the type returned by functions creating strings like PyUnicode_New(), PyUnicode_FromString(), etc.

Maybe for this specific header file, we can avoid casts.

For me, PyASCIIObject is an implementation detail which should be hidden. If possible, it should even be moved to the internal C API, but that's a way larger topic which may require a PEP ;-)