[issue8215] getargs.c in Python3 contains some TODO and the documentation is outdated
STINNER Victor
report at bugs.python.org
Sat May 29 02:07:20 CEST 2010
STINNER Victor <victor.stinner at 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 <report at bugs.python.org>
<http://bugs.python.org/issue8215>
_______________________________________
More information about the Python-bugs-list
mailing list