[docs] [issue33126] Some C buffer protocol APIs not documented

Stefan Krah report at bugs.python.org
Sun Mar 25 14:18:52 EDT 2018


Stefan Krah <stefan at bytereef.org> added the comment:

Yes, the signatures are weird. In PyBuffer_FromContiguous(), "len" is
the size of "buf" in bytes.

If "buf" contains 6 floats, but "view" only has space for 4, then only
4 are copied into "view".


To avoid that sort of thing, I changed PyBuffer_ToContiguous() to
be more restrictive in 3.3, but kept the len parameter.

In PyBuffer_ToContiguous() it would not matter though if len(buf) > src->len, in which case buf would contain uninitialized bytes at
the end.


TBH, I don't think these functions are used very often. :-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33126>
_______________________________________


More information about the docs mailing list