[Python-Dev] Assertion in _PyManagedBuffer_FromObject() (original) (raw)
Stefan Krah stefan at bytereef.org
Sat Mar 3 13:52:18 CET 2012
- Previous message: [Python-Dev] Matrix testing against CPython releases (was: Re: Assertion in _PyManagedBuffer_FromObject())
- Next message: [Python-Dev] Assertion in _PyManagedBuffer_FromObject()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Nick Coghlan <ncoghlan at 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 PyObjectGetBuffer)
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
- Previous message: [Python-Dev] Matrix testing against CPython releases (was: Re: Assertion in _PyManagedBuffer_FromObject())
- Next message: [Python-Dev] Assertion in _PyManagedBuffer_FromObject()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]