[Python-Dev] PEP3118, python 2.6 (original) (raw)

Thomas Heller theller at ctypes.org
Thu Jun 5 17:08:10 CEST 2008


Hi Travis,

I'm currently trying to port the pep3118 ctypes changes which are already in the py3k branch to the trunk.

In py3k the tests for this stuff (in Lib/ctypes/test/test_pep3118.py) use the memoryview object which exposes attributes like .format, .shape, .strides and so on for objects implementing the new buffer interface.

In Python 2.6 memoryview does not exist so the question is how to write a test that checks for the correct attributes. My idea is to implement the array_interface property for ctypes instances, as described in this document http://numpy.scipy.org/array_interface.shtml.

Do you think this is a good idea, or would it be better to invent another, private, mechanism for the tests? In other words: Would the array_interface property (version 3) on these objects be useful for external code or would it disrupt external code?

BTW: Did you have a chance to look over the test_pep3118 module in py3k, to make sure that I got things correctly (it should be pretty easy to read, imo)?

Thanks, Thomas



More information about the Python-Dev mailing list