bpo-35582: Argument Clinic: inline parsing code for positional parameters. by serhiy-storchaka · Pull Request #11313 · python/cpython
Would it be possible to find a different name for the function? Otherwise, it's unclear what is _PyArg_CheckPositional(). For _PyUnicodeWriter, I used _PyUnicodeWriter_Prepare (macro) and _PyUnicodeWriter_PrepareInternal (func) names.
/* Prepare the buffer to write 'length' characters
with the specified maximum character.
Return 0 on success, raise an exception and return -1 on error. */
#define _PyUnicodeWriter_Prepare(WRITER, LENGTH, MAXCHAR) \
(((MAXCHAR) <= (WRITER)->maxchar \
&& (LENGTH) <= (WRITER)->size - (WRITER)->pos) \
? 0 \
: (((LENGTH) == 0) \
? 0 \
: _PyUnicodeWriter_PrepareInternal((WRITER), (LENGTH), (MAXCHAR))))
/* Don't call this function directly, use the _PyUnicodeWriter_Prepare() macro
instead. */
PyAPI_FUNC(int)
_PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
Py_ssize_t length, Py_UCS4 maxchar);
You may write a static inline function rather than a macro.