File indexing completed on 2025-01-18 10:06:40
0001 #ifndef Py_CPYTHON_BYTESOBJECT_H
0002 # error "this header file must not be included directly"
0003 #endif
0004
0005 typedef struct {
0006 PyObject_VAR_HEAD
0007 Py_DEPRECATED(3.11) Py_hash_t ob_shash;
0008 char ob_sval[1];
0009
0010
0011
0012
0013
0014
0015 } PyBytesObject;
0016
0017 PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t);
0018 PyAPI_FUNC(PyObject*) _PyBytes_FormatEx(
0019 const char *format,
0020 Py_ssize_t format_len,
0021 PyObject *args,
0022 int use_bytearray);
0023 PyAPI_FUNC(PyObject*) _PyBytes_FromHex(
0024 PyObject *string,
0025 int use_bytearray);
0026
0027
0028 PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t,
0029 const char *, const char **);
0030
0031
0032 #define _PyBytes_CAST(op) \
0033 (assert(PyBytes_Check(op)), _Py_CAST(PyBytesObject*, op))
0034
0035 static inline char* PyBytes_AS_STRING(PyObject *op)
0036 {
0037 return _PyBytes_CAST(op)->ob_sval;
0038 }
0039 #define PyBytes_AS_STRING(op) PyBytes_AS_STRING(_PyObject_CAST(op))
0040
0041 static inline Py_ssize_t PyBytes_GET_SIZE(PyObject *op) {
0042 PyBytesObject *self = _PyBytes_CAST(op);
0043 return Py_SIZE(self);
0044 }
0045 #define PyBytes_GET_SIZE(self) PyBytes_GET_SIZE(_PyObject_CAST(self))
0046
0047
0048
0049 PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
0050
0051
0052
0053
0054
0055 typedef struct {
0056
0057 PyObject *buffer;
0058
0059
0060 Py_ssize_t allocated;
0061
0062
0063
0064 Py_ssize_t min_size;
0065
0066
0067 int use_bytearray;
0068
0069
0070
0071 int overallocate;
0072
0073
0074 int use_small_buffer;
0075 char small_buffer[512];
0076 } _PyBytesWriter;
0077
0078
0079
0080
0081
0082 PyAPI_FUNC(void) _PyBytesWriter_Init(_PyBytesWriter *writer);
0083
0084
0085
0086
0087 PyAPI_FUNC(PyObject *) _PyBytesWriter_Finish(_PyBytesWriter *writer,
0088 void *str);
0089
0090
0091 PyAPI_FUNC(void) _PyBytesWriter_Dealloc(_PyBytesWriter *writer);
0092
0093
0094
0095
0096 PyAPI_FUNC(void*) _PyBytesWriter_Alloc(_PyBytesWriter *writer,
0097 Py_ssize_t size);
0098
0099
0100
0101
0102
0103
0104
0105 PyAPI_FUNC(void*) _PyBytesWriter_Prepare(_PyBytesWriter *writer,
0106 void *str,
0107 Py_ssize_t size);
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120 PyAPI_FUNC(void*) _PyBytesWriter_Resize(_PyBytesWriter *writer,
0121 void *str,
0122 Py_ssize_t size);
0123
0124
0125
0126 PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer,
0127 void *str,
0128 const void *bytes,
0129 Py_ssize_t size);