Author rhansen
Recipients rhansen
Date 2015-01-30.01:33:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
According to if the suboffsets member of Py_buffer is non-NULL and all members of the array are negative, the buffer may be contiguous.

PyBuffer_IsContiguous() does not behave this way.  It assumes that if the suboffsets member is non-NULL then at least one member of the array is non-negative, and thus assumes that the buffer is non-contiguous.  This is not always correct.

One consequence of this bug is PyBuffer_ToContiguous() (and thus memoryview.tobytes()) falls back to slow (and currently buggy, see issue #23349) memory copying code.

Attached is a patch that fixes this bug.  The patch is against 2.7 but can be trivially modified to apply to 3.x.
Date User Action Args
2015-01-30 01:33:45rhansensetrecipients: + rhansen
2015-01-30 01:33:45rhansensetmessageid: <>
2015-01-30 01:33:44rhansenlinkissue23352 messages
2015-01-30 01:33:43rhansencreate