Nick Coghlan <ncogh...@gmail.com> wrote:
> 2. the current check is too strict (it should just check for obj !=
> NULL, not obj == &exporter)

Yes. For anyone who is interested, see issue #14181.


> 3. the current check is in the wrong place (it should be in 
> PyObject_GetBuffer)

Agreed, since it's not memoryview specific. But I don't think we even
need to check for obj != NULL. view.obj was undocumented, and since 3.0
Include/object.h contains this:


typedef struct bufferinfo {
    void *buf;
    PyObject *obj;        /* owned reference */


So it would be somewhat audacious to set this field to NULL. But even if
existing code uses the view.obj==NULL scheme from PyBuffer_FillInfo()
correctly, it will still work in the new implementation.

I'd just prefer to forbid this in the documentation, because it's much
easier to remember: getbuffer "returns" a new reference or NULL.



Stefan Krah



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to