Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
bytesobject.h43 linesDownload Raw Back to cpython
1#ifndef Py_CPYTHON_BYTESOBJECT_H2#  error "this header file must not be included directly"3#endif4 5typedef struct {6    PyObject_VAR_HEAD7    Py_DEPRECATED(3.11) Py_hash_t ob_shash;8    char ob_sval[1];9 10    /* Invariants:11     *     ob_sval contains space for 'ob_size+1' elements.12     *     ob_sval[ob_size] == 0.13     *     ob_shash is the hash of the byte string or -1 if not computed yet.14     */15} PyBytesObject;16 17PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t);18 19/* Macros and static inline functions, trading safety for speed */20#define _PyBytes_CAST(op) \21    (assert(PyBytes_Check(op)), _Py_CAST(PyBytesObject*, op))22 23static inline char* PyBytes_AS_STRING(PyObject *op)24{25    return _PyBytes_CAST(op)->ob_sval;26}27#define PyBytes_AS_STRING(op) PyBytes_AS_STRING(_PyObject_CAST(op))28 29static inline Py_ssize_t PyBytes_GET_SIZE(PyObject *op) {30    PyBytesObject *self = _PyBytes_CAST(op);31    return Py_SIZE(self);32}33#define PyBytes_GET_SIZE(self) PyBytes_GET_SIZE(_PyObject_CAST(self))34 35PyAPI_FUNC(PyObject*) PyBytes_Join(PyObject *sep, PyObject *iterable);36 37// Deprecated alias kept for backward compatibility38Py_DEPRECATED(3.14) static inline PyObject*39_PyBytes_Join(PyObject *sep, PyObject *iterable)40{41    return PyBytes_Join(sep, iterable);42}43 
codekingpro/portable-devtools · Team Ai