python (3.11.7)

(root)/
include/
python3.11/
cpython/
descrobject.h
       1  #ifndef Py_CPYTHON_DESCROBJECT_H
       2  #  error "this header file must not be included directly"
       3  #endif
       4  
       5  typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
       6                                   void *wrapped);
       7  
       8  typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args,
       9                                        void *wrapped, PyObject *kwds);
      10  
      11  struct wrapperbase {
      12      const char *name;
      13      int offset;
      14      void *function;
      15      wrapperfunc wrapper;
      16      const char *doc;
      17      int flags;
      18      PyObject *name_strobj;
      19  };
      20  
      21  /* Flags for above struct */
      22  #define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */
      23  
      24  /* Various kinds of descriptor objects */
      25  
      26  typedef struct {
      27      PyObject_HEAD
      28      PyTypeObject *d_type;
      29      PyObject *d_name;
      30      PyObject *d_qualname;
      31  } PyDescrObject;
      32  
      33  #define PyDescr_COMMON PyDescrObject d_common
      34  
      35  #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
      36  #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
      37  
      38  typedef struct {
      39      PyDescr_COMMON;
      40      PyMethodDef *d_method;
      41      vectorcallfunc vectorcall;
      42  } PyMethodDescrObject;
      43  
      44  typedef struct {
      45      PyDescr_COMMON;
      46      PyMemberDef *d_member;
      47  } PyMemberDescrObject;
      48  
      49  typedef struct {
      50      PyDescr_COMMON;
      51      PyGetSetDef *d_getset;
      52  } PyGetSetDescrObject;
      53  
      54  typedef struct {
      55      PyDescr_COMMON;
      56      struct wrapperbase *d_base;
      57      void *d_wrapped; /* This can be any function pointer */
      58  } PyWrapperDescrObject;
      59  
      60  PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type;
      61  
      62  PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
      63                                                  struct wrapperbase *, void *);
      64  PyAPI_FUNC(int) PyDescr_IsData(PyObject *);