PyObject_AsCharBuffer does exactly what I want: It allows me to extract the data from a python
array of bytes (from within C). The trouble is that it has been deprecated for years, and I am supposed to use the “new” buffer protocol. The trouble with that is that
PyBuf is an opaque type when using the Limited API.
What is the recommended approach?
- Add lots of preprocessor magic to switch off deprecation warnings with both GCC and Clang for the duration of the call?
- Persuade the Python devs to not deprecate PyObject_AsCharBuffer when building the Limited API? (But that causes grief for source that wants to work both Limited and non-Limited, and doesn’t work when I am still building against Python 3.10 source)
- Call this other obvious function? (This is my preferred solution, but I can’t find what the function is called.)