This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients ncoghlan, pitrou, skrah
Date 2012-03-05.18:32:48
SpamBayes Score 4.4844415e-07
Marked as misclassified No
Message-id <1330972369.17.0.543217676638.issue14203@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-03-05 18:32:49skrahsetrecipients: + skrah, ncoghlan, pitrou
2012-03-05 18:32:49skrahsetmessageid: <1330972369.17.0.543217676638.issue14203@psf.upfronthosting.co.za>
2012-03-05 18:32:48skrahlinkissue14203 messages
2012-03-05 18:32:48skrahcreate