1/* ByteArray object interface */
2
3#ifndef Py_BYTEARRAYOBJECT_H
4#define Py_BYTEARRAYOBJECT_H
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#include <stdarg.h>
10
11/* Type PyByteArrayObject represents a mutable array of bytes.
12 * The Python API is that of a sequence;
13 * the bytes are mapped to ints in [0, 256).
14 * Bytes are not characters; they may be used to encode characters.
15 * The only way to go between bytes and str/unicode is via encoding
16 * and decoding.
17 * For the convenience of C programmers, the bytes type is considered
18 * to contain a char pointer, not an unsigned char pointer.
19 */
20
21/* Type object */
22PyAPI_DATA(PyTypeObject) PyByteArray_Type;
23PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type;
24
25/* Type check macros */
26#define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type)
27#define PyByteArray_CheckExact(self) Py_IS_TYPE(self, &PyByteArray_Type)
28
29/* Direct API functions */
30PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *);
31PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *);
32PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t);
33PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *);
34PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *);
35PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t);
36
37#ifndef Py_LIMITED_API
38# define Py_CPYTHON_BYTEARRAYOBJECT_H
39# include "cpython/bytearrayobject.h"
40# undef Py_CPYTHON_BYTEARRAYOBJECT_H
41#endif
42
43#ifdef __cplusplus
44}
45#endif
46#endif /* !Py_BYTEARRAYOBJECT_H */
47