Message106699
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. |
|
Date |
User |
Action |
Args |
2010-05-29 00:07:20 | vstinner | set | recipients:
+ vstinner, barry, brett.cannon, georg.brandl, benjamin.peterson |
2010-05-29 00:07:20 | vstinner | set | messageid: <1275091640.36.0.763704176734.issue8215@psf.upfronthosting.co.za> |
2010-05-29 00:07:18 | vstinner | link | issue8215 messages |
2010-05-29 00:07:18 | vstinner | create | |
|