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

source code of include/python3.12/bytearrayobject.h