[issue15821] Improve docs for PyMemoryView_FromBuffer()
Alexander Belopolsky
report at bugs.python.org
Thu Aug 30 16:36:13 CEST 2012
Alexander Belopolsky added the comment:
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.
----------
keywords: +patch
Added file: http://bugs.python.org/file27059/_testbuffer.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15821>
_______________________________________
More information about the Python-bugs-list
mailing list