First, thanks for doing this -- Python really needs it!
While this approach works, it requires attribute lookups which can be expensive when sharing many small arrays.
Ah, I do like reducing that overhead -- I know I use arrays a lot for small data sets too, so that overhead can be significant.
I'm not well qualified to review the tech details, but to make sure I have this right:
static PyObject* bf_getarrayview (PyObject *obj) This function must return a new reference to a PyArrViewObject which contains the details of the array information exposed by the object. If failure occurs, then NULL is returned and an exception set.
So If I have some C code that wants to use any array passed in, I can just call:
and if it doesn't return NULL, I have a valid array that I can query to see if it fits what I'm expecting.
Have I got that right?
If so, this would be great.
By the way,, how compatible is this with the existing buffer protocol?