STINNER Victor <victor.stin...@haypocalc.com> added the comment: Patch to cleanup getbuffer() and convertbuffer(): - getbuffer() doesn't call convertbuffer() if pb->bf_getbuffer==NULL. If pb->bf_getbuffer==NULL, PyObject_GetBuffer() fails and so the call to convertbuffer() is useless. - convertbuffer() calls getbuffer() to check that the buffer is 'C" contiguous (and to factorize the code) - release the buffer if the buffer is not contigous => fix a bug - rename "errmsg" and "buf" to "expected" to reuse converterror() term - Remove /* XXX Really? */: I don't understand the comment and the code looks ok
The main change is that convertbuffer() now requires a "C" contiguous buffer. That change concerns "s#", "y", "z" and "t#" formats. If a function would like to support non contiguous buffers, it should use "O" format and then PyObject_GetBuffer(). I don't think that builtin Python functions do support non contiguous buffers. ---------- keywords: +patch Added file: http://bugs.python.org/file17488/getarg_cleanup_buffer.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8215> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com