[Python-Dev] Assertion in _PyManagedBuffer_FromObject()
Nick Coghlan
ncoghlan at gmail.com
Sat Mar 3 00:49:34 CET 2012
On Sat, Mar 3, 2012 at 3:14 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Stefan Krah, 02.03.2012 17:42:
>> 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.
>
> Right. Then it's only safe when the intermediate provider knows what the
> underlying buffer providers do. Not unlikely in an application setting,
> though, and it could just be an option at creation time to activate the
> delegation for the ndarray above.
OK, my take on the discussion so far:
1. assert() is the wrong tool for this job (it should trigger a Python
error message)
2. the current check is too strict (it should just check for obj !=
NULL, not obj == &exporter)
3. the current check is in the wrong place (it should be in PyObject_GetBuffer)
Sound about right?
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev
mailing list