cypext: PyObject_Vectorcall issues with PY_VECTORCALL_ARGUMENTS_OFFSET
Dear PyPy team (& @mattip),
recent PyPy versions implement the PEP-590 API (
PyObject_Vectorcall et al.). While developing an extension using this interface, I noticed crashes with the message
Invalid RPython operation (NULL ptr or bad array index) that I eventually tracked down to my use of the flag
PY_VECTORCALL_ARGUMENTS_OFFSET in the
nargs call argument of
PyObject_Vectorcall. When removing this flag, I can get the calls to work. This is code that has been tested to work on all CPython versions 3.8-3.12 on all major OSes.
Hence, I am wondering: is it possible that PyPy does not fully implement this flag, interpreting
nargs as a huge argument list when the macro is OR-ed into the argument count? (this macro is defined as
((size_t)1 << (8 * sizeof(size_t) - 1)), which is a very large number).