[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

Stefan Krah report at bugs.python.org
Sat Jan 31 14:03:16 CET 2015


Stefan Krah added the comment:

Cython doesn't follow the spec though (use Python 3):

from _testbuffer import *

cpdef foo():
    cdef unsigned char[:] v = bytearray(b"testing")
    nd = ndarray(v, getbuf=PyBUF_ND)
    print(nd.suboffsets)
    nd = ndarray(v, getbuf=PyBUF_FULL)
    print(nd.suboffsets)


Cython hands out suboffsets even for a PyBUF_ND request, which is
definitely wrong.  For a PyBUF_FULL request they should only be
provided *if needed*.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23352>
_______________________________________


More information about the Python-bugs-list mailing list