Hey,

So I'm working on interfacing numpy ndarrays with an n-dimensional array
representation that exists as part of a massive custom C library. Due to the
size of the library, hand-coding a c-extension for the library just was not
really an option; so we wound up using gcc_xml to generate the proper ctypes
code. This works great for accessing our C functions within python, but not
so much for trying share memory between numpy and our custom array
representations... Passing a pointer to the numpy array data to ctypes is
fairly simple, but figuring out the proper way to get memory from ctypes
into numpy has been problematic.

I know that PEP 3118 is supposed to be superseding the numpy array
interface, but PEP 3118 can only be specified on the C side, which is
problematic for anybody using ctypes to wrap their C code. The legacy
__array_interface__ allows for a python side specification of data buffers,
but there appears to be no corresponding interface capability in the PEP
3118 protocol. On top of that add the fact that Python's own support for PEP
3118 has some major bugs (ctypes throwing invalid PEP 3118 codes -
http://bugs.python.org/issue10746 :: issues with python's memoryview object
- http://bugs.python.org/issue10181), and PEP 3118 seems like a nightmare to
deal with. At the same time though, I don't want to simply use the legacy
array interface if it's going to be completely deprecated in the near
future.

How long before the legacy __array_interface__ goes the way of the dodo?
When that happens, are there plans to add support for a python side
interface to the PEP 3118 protocol? If not, what is the proper way to
interface a ctypes wrapped library with PEP 3118?

Thanks,

 - Sam Quinan


_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to