◐ Shell
clean mode source ↗

Message 169460 - Python tracker

Having been bitten by an indirect buffer bug in 2.7, I decided to write some tests for 3.3.  I added an objview() function to _testbuffer module that creates an indirect view for nested tuples.  I have not written unit tests yet, so I'll attach a demo script test_indirect.py.

I hope this test case will be helpful in figuring out the right semantics for PyMemoryView_FromBuffer().  My feeling is that memoryview should be able to store shape/strides/suboffsets arrays in its own structure.  I also think the only way to achieve that is to make it a PyVarObject and allocate up to sizeof(Py_ssize_t)*ndim*3 bytes after the "view" substructure to store copies of shape/strides/suboffsets arrays.