[Python-Dev] Assertion in _PyManagedBuffer_FromObject()
Stefan Krah
stefan at bytereef.org
Fri Mar 2 17:42:26 CET 2012
More information about the Python-Dev mailing list
Fri Mar 2 17:42:26 CET 2012
- Previous message: [Python-Dev] Assertion in _PyManagedBuffer_FromObject()
- Next message: [Python-Dev] Assertion in _PyManagedBuffer_FromObject()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Stefan Krah <stefan at bytereef.org> wrote: > > Why would the object that bf_getbuffer() is being called on have to > > be identical with the one that exports the buffer? > > It doesn't have to be. This is now possible: > > >>> from _testbuffer import * > >>> exporter = b'123' > >>> nd = ndarray(exporter) > >>> m = memoryview(nd) > >>> nd.obj > b'123' > >>> m.obj > <ndarray object at 0x7fbef33677d8> Stefan (Behnel), do you have an existing example object that does what you described? If I understand correctly, in the above example the ndarray would redirect the buffer request to 'exporter' and set m.obj to 'exporter'. It would be nice to know if people are actually using this. The reason why this scheme was not chosen for a chain of memoryviews was that 'exporter' (in theory) could implement a slideshow of buffers, which means that in the face of redirecting requests m might not be equal to nd. Stefan Krah
- Previous message: [Python-Dev] Assertion in _PyManagedBuffer_FromObject()
- Next message: [Python-Dev] Assertion in _PyManagedBuffer_FromObject()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list