File indexing completed on 2025-01-18 10:06:40
0001 #ifndef Py_CPYTHON_BYTEARRAYOBJECT_H
0002 # error "this header file must not be included directly"
0003 #endif
0004
0005
0006 typedef struct {
0007 PyObject_VAR_HEAD
0008 Py_ssize_t ob_alloc;
0009 char *ob_bytes;
0010 char *ob_start;
0011 Py_ssize_t ob_exports;
0012 } PyByteArrayObject;
0013
0014 PyAPI_DATA(char) _PyByteArray_empty_string[];
0015
0016
0017 #define _PyByteArray_CAST(op) \
0018 (assert(PyByteArray_Check(op)), _Py_CAST(PyByteArrayObject*, op))
0019
0020 static inline char* PyByteArray_AS_STRING(PyObject *op)
0021 {
0022 PyByteArrayObject *self = _PyByteArray_CAST(op);
0023 if (Py_SIZE(self)) {
0024 return self->ob_start;
0025 }
0026 return _PyByteArray_empty_string;
0027 }
0028 #define PyByteArray_AS_STRING(self) PyByteArray_AS_STRING(_PyObject_CAST(self))
0029
0030 static inline Py_ssize_t PyByteArray_GET_SIZE(PyObject *op) {
0031 PyByteArrayObject *self = _PyByteArray_CAST(op);
0032 return Py_SIZE(self);
0033 }
0034 #define PyByteArray_GET_SIZE(self) PyByteArray_GET_SIZE(_PyObject_CAST(self))