• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef Py_CPYTHON_BYTEARRAYOBJECT_H
2 #  error "this header file must not be included directly"
3 #endif
4 
5 /* Object layout */
6 typedef struct {
7     PyObject_VAR_HEAD
8     Py_ssize_t ob_alloc;   /* How many bytes allocated in ob_bytes */
9     char *ob_bytes;        /* Physical backing buffer */
10     char *ob_start;        /* Logical start inside ob_bytes */
11     Py_ssize_t ob_exports; /* How many buffer exports */
12 } PyByteArrayObject;
13 
14 /* Macros, trading safety for speed */
15 #define PyByteArray_AS_STRING(self) \
16     (assert(PyByteArray_Check(self)), \
17      Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_start : _PyByteArray_empty_string)
18 #define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)), Py_SIZE(self))
19 
20 PyAPI_DATA(char) _PyByteArray_empty_string[];
21