You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ENH: Remove remnants of Python 2 buffer protocol from NumPy internals #30813
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.
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.
changed the title [-][ENH] Remove remnants of Python 2 buffer protocol from NumPy internals[/-][+]ENH: Remove remnants of Python 2 buffer protocol from NumPy internals[/+]on Feb 10, 2026
This function is used for reinterpreting buffer imports that ignore the original type (frombuffer/new constructor). Talking about the old buffer protocol is wrong of course...
But I am OK to deprecate it. It is unlikely NumPy users need it and non-NumPy users should use the buffer protocol directly.
Activity
[-][ENH] Remove remnants of Python 2 buffer protocol from NumPy internals[/-][+]ENH: Remove remnants of Python 2 buffer protocol from NumPy internals[/+]charris commentedon Feb 10, 2026
That sounds good to me. If there is a problem, now would be when to find it.
seberg commentedon Feb 11, 2026
This function is used for reinterpreting buffer imports that ignore the original type (frombuffer/new constructor). Talking about the old buffer protocol is wrong of course...
But I am OK to deprecate it. It is unlikely NumPy users need it and non-NumPy users should use the buffer protocol directly.
sharmavikas18 commentedon Mar 7, 2026
I would like to work on this issue.