-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Description
I'm noticing this because I'm touching the NumPy headers to fix #30704. That includes touching PyArray_Chunk.
It took me quite a while to understand what PyArray_Chunk and PyArray_BufferConverter are doing, because they're based on the very old "single-segment" buffer protocol. See PEP 3118 for more historical details.
PyArray_Chunk corresponds to PyBufferObject, which was completely removed from the Python C API in the 2->3 transition. See e.g. https://docs.python.org/2.7/c-api/buffer.html?highlight=pybufferobject#c.PyBufferObject.
The docs for PyArray_FromBuffer also talk about a single-segment buffer protocol, but that function has supported the "new" buffer protocol for a very long time.
PyArray_BufferConverter is publicly exposed, it's also used inside array_new, so it is somewhat load-bearing unfortunately.
As far as I can see, PyArray_BufferConverter has zero uses outside NumPy in public code on Github outside of copies of NumPy or wrappers around the entire NumPy C API: https://github.com/search?q=PyArray_BufferConverter&type=code&p=2. Maybe we can just deprecate the public version, along with PyArray_Chunk?
We should also update the docs to no longer talk about the Python 2 buffer protocol.
Possibly related issues: