picop.cybuffer#

Buffer protocol helpers.

picop.cybuffer.buf_check(obj)#

Return True if obj supports the buffer protocol (PyObject_CheckBuffer). :type obj: object :param obj:

Return type:

bool

Parameters:

obj (object)

picop.cybuffer.buf_copy_data(dest, src)#

Copy buffer data from src into writable dest via PyObject_CopyData.

Notes

Returns 0 on success and -1 on error; errors raise. Do not use the status int as a bool.

Parameters:
Return type:

int

picop.cybuffer.buf_eq(a, b)#

Return True if buffer-protocol views are equal.

Notes

C-contiguous buffers use memcmp; otherwise memoryview richcompare. Format/size mismatch yields False.

Parameters:
Return type:

bool

picop.cybuffer.buf_itemsize(obj)#

Return the item size of obj’s exported buffer. :type obj: object :param obj:

Return type:

int

picop.cybuffer.buf_nbytes(obj)#

Return the total byte length of obj’s exported buffer. :type obj: object :param obj:

Return type:

int

picop.cybuffer.buf_ndim(obj)#

Return the dimensionality of obj’s exported buffer. :type obj: object :param obj:

Return type:

int

picop.cybuffer.buf_readonly(obj)#

Return whether obj exports a read-only buffer. :type obj: object :param obj:

Return type:

bool