bytearray_getbuffer() checks for view==NULL. But this has never been
allowed:
PEP: "The second argument is the address to a bufferinfo structure.
Both arguments must never be NULL."
DOCS (3.2): "view must point to an existing Py_buffer structure
allocated by the caller".
A quick grep through the source tree shows no instances where
the middle argument of either PyObject_GetBuffer of bf_getbuffer
is NULL or 0.
Patch attached, all tests pass. I wouldn't be comfortable to
commit it without review though (it's just too strange).
BTW, the next conditional in bytearray_getbuffer ...
if (ret >= 0) {
obj->ob_exports++;
}
is also superfluous, since PyBuffer_FillInfo() cannot fail
if readonly==0.
|