Message106699
| Author |
vstinner |
| Recipients |
barry, benjamin.peterson, brett.cannon, georg.brandl, vstinner |
| Date |
2010年05月29日.00:07:16 |
| SpamBayes Score |
0.0006354593 |
| Marked as misclassified |
No |
| Message-id |
<1275091640.36.0.763704176734.issue8215@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|