Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:49

0001 /* Descriptors */
0002 #ifndef Py_DESCROBJECT_H
0003 #define Py_DESCROBJECT_H
0004 #ifdef __cplusplus
0005 extern "C" {
0006 #endif
0007 
0008 typedef PyObject *(*getter)(PyObject *, void *);
0009 typedef int (*setter)(PyObject *, PyObject *, void *);
0010 
0011 struct PyGetSetDef {
0012     const char *name;
0013     getter get;
0014     setter set;
0015     const char *doc;
0016     void *closure;
0017 };
0018 
0019 PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type;
0020 PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type;
0021 PyAPI_DATA(PyTypeObject) PyMemberDescr_Type;
0022 PyAPI_DATA(PyTypeObject) PyMethodDescr_Type;
0023 PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
0024 PyAPI_DATA(PyTypeObject) PyDictProxy_Type;
0025 PyAPI_DATA(PyTypeObject) PyProperty_Type;
0026 
0027 PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
0028 PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
0029 PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, PyMemberDef *);
0030 PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, PyGetSetDef *);
0031 
0032 PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
0033 PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);
0034 
0035 
0036 /* An array of PyMemberDef structures defines the name, type and offset
0037    of selected members of a C structure.  These can be read by
0038    PyMember_GetOne() and set by PyMember_SetOne() (except if their READONLY
0039    flag is set).  The array must be terminated with an entry whose name
0040    pointer is NULL. */
0041 struct PyMemberDef {
0042     const char *name;
0043     int type;
0044     Py_ssize_t offset;
0045     int flags;
0046     const char *doc;
0047 };
0048 
0049 // These constants used to be in structmember.h, not prefixed by Py_.
0050 // (structmember.h now has aliases to the new names.)
0051 
0052 /* Types */
0053 #define Py_T_SHORT     0
0054 #define Py_T_INT       1
0055 #define Py_T_LONG      2
0056 #define Py_T_FLOAT     3
0057 #define Py_T_DOUBLE    4
0058 #define Py_T_STRING    5
0059 #define _Py_T_OBJECT   6  // Deprecated, use Py_T_OBJECT_EX instead
0060 /* the ordering here is weird for binary compatibility */
0061 #define Py_T_CHAR      7   /* 1-character string */
0062 #define Py_T_BYTE      8   /* 8-bit signed int */
0063 /* unsigned variants: */
0064 #define Py_T_UBYTE     9
0065 #define Py_T_USHORT    10
0066 #define Py_T_UINT      11
0067 #define Py_T_ULONG     12
0068 
0069 /* Added by Jack: strings contained in the structure */
0070 #define Py_T_STRING_INPLACE    13
0071 
0072 /* Added by Lillo: bools contained in the structure (assumed char) */
0073 #define Py_T_BOOL      14
0074 
0075 #define Py_T_OBJECT_EX 16
0076 #define Py_T_LONGLONG  17
0077 #define Py_T_ULONGLONG 18
0078 
0079 #define Py_T_PYSSIZET  19      /* Py_ssize_t */
0080 #define _Py_T_NONE     20 // Deprecated. Value is always None.
0081 
0082 /* Flags */
0083 #define Py_READONLY            1
0084 #define Py_AUDIT_READ          2 // Added in 3.10, harmless no-op before that
0085 #define _Py_WRITE_RESTRICTED   4 // Deprecated, no-op. Do not reuse the value.
0086 #define Py_RELATIVE_OFFSET     8
0087 
0088 PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, PyMemberDef *);
0089 PyAPI_FUNC(int) PyMember_SetOne(char *, PyMemberDef *, PyObject *);
0090 
0091 #ifndef Py_LIMITED_API
0092 #  define Py_CPYTHON_DESCROBJECT_H
0093 #  include "cpython/descrobject.h"
0094 #  undef Py_CPYTHON_DESCROBJECT_H
0095 #endif
0096 
0097 #ifdef __cplusplus
0098 }
0099 #endif
0100 #endif /* !Py_DESCROBJECT_H */