Source

opycaml / bytearray.idl.in

Full commit
// -------------------------- Byte array

// PyByteArrayObject;
//    This subtype of PyObject represents a Python bytearray object.

// PyTypeObject PyByteArray_Type;
//    This instance of PyTypeObject represents the Python bytearray type; it is the same object as bytearray in the Python layer.

boolean PyByteArray_Check(PyObject *o);
//    Return true if the object o is a bytearray object or an instance of a subtype of the bytearray type.

boolean PyByteArray_CheckExact(PyObject *o);
//    Return true if the object o is a bytearray object, but not an instance of a subtype of the bytearray type.

[new] PyByteArrayObject* PyByteArray_FromObject(PyObject *o);
//    Return a new bytearray object from any object, o, that implements the buffer protocol.

[new] PyByteArrayObject* PyByteArray_FromStringAndSize([string] const char *string, Py_ssize_t len);
//    Create a new bytearray object from string and its length, len. On failure, NULL is returned.

[new] PyByteArrayObject* PyByteArray_Concat(PyByteArrayObject *a, PyByteArrayObject *b); [mlname concatByteArray]
//    Concat bytearrays a and b and return a new bytearray with the result.

size_or_fail PyByteArray_Size(PyByteArrayObject *bytearray);
//    Return the size of bytearray after checking for a NULL pointer.

[string] char* PyByteArray_AsString(PyByteArrayObject *bytearray);
//    Return the contents of bytearray as a char array after checking for a NULL pointer.

unit_or_fail /* ? */ PyByteArray_Resize(PyByteArrayObject *bytearray, Py_ssize_t len); // return type is int
//    Resize the internal buffer of bytearray to len.

// These macros trade safety for speed and they don’t check pointers.

[string] char* PyByteArray_AS_STRING(PyByteArrayObject *bytearray);
//    Macro version of PyByteArray_AsString().

Py_ssize_t PyByteArray_GET_SIZE(PyByteArrayObject *bytearray);
//    Macro version of PyByteArray_Size().