File indexing completed on 2025-11-19 09:50:53
0001
0002
0003
0004 #ifndef Py_MODULEOBJECT_H
0005 #define Py_MODULEOBJECT_H
0006 #ifdef __cplusplus
0007 extern "C" {
0008 #endif
0009
0010 PyAPI_DATA(PyTypeObject) PyModule_Type;
0011
0012 #define PyModule_Check(op) PyObject_TypeCheck((op), &PyModule_Type)
0013 #define PyModule_CheckExact(op) Py_IS_TYPE((op), &PyModule_Type)
0014
0015 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
0016 PyAPI_FUNC(PyObject *) PyModule_NewObject(
0017 PyObject *name
0018 );
0019 #endif
0020 PyAPI_FUNC(PyObject *) PyModule_New(
0021 const char *name
0022 );
0023 PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
0024 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
0025 PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *);
0026 #endif
0027 PyAPI_FUNC(const char *) PyModule_GetName(PyObject *);
0028 Py_DEPRECATED(3.2) PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
0029 PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *);
0030 PyAPI_FUNC(PyModuleDef*) PyModule_GetDef(PyObject*);
0031 PyAPI_FUNC(void*) PyModule_GetState(PyObject*);
0032
0033 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
0034
0035 PyAPI_FUNC(PyObject *) PyModuleDef_Init(PyModuleDef*);
0036 PyAPI_DATA(PyTypeObject) PyModuleDef_Type;
0037 #endif
0038
0039 typedef struct PyModuleDef_Base {
0040 PyObject_HEAD
0041
0042
0043
0044
0045
0046
0047 PyObject* (*m_init)(void);
0048
0049
0050
0051
0052 Py_ssize_t m_index;
0053
0054
0055
0056
0057 PyObject* m_copy;
0058 } PyModuleDef_Base;
0059
0060 #define PyModuleDef_HEAD_INIT { \
0061 PyObject_HEAD_INIT(_Py_NULL) \
0062 _Py_NULL, \
0063 0, \
0064 _Py_NULL, \
0065 }
0066
0067 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
0068
0069 struct PyModuleDef_Slot {
0070 int slot;
0071 void *value;
0072 };
0073
0074 #define Py_mod_create 1
0075 #define Py_mod_exec 2
0076 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030c0000
0077 # define Py_mod_multiple_interpreters 3
0078 #endif
0079 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
0080 # define Py_mod_gil 4
0081 #endif
0082
0083
0084 #ifndef Py_LIMITED_API
0085 #define _Py_mod_LAST_SLOT 4
0086 #endif
0087
0088 #endif
0089
0090
0091 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030c0000
0092 # define Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED ((void *)0)
0093 # define Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED ((void *)1)
0094 # define Py_MOD_PER_INTERPRETER_GIL_SUPPORTED ((void *)2)
0095 #endif
0096
0097
0098 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
0099 # define Py_MOD_GIL_USED ((void *)0)
0100 # define Py_MOD_GIL_NOT_USED ((void *)1)
0101 #endif
0102
0103 #if !defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED)
0104 PyAPI_FUNC(int) PyUnstable_Module_SetGIL(PyObject *module, void *gil);
0105 #endif
0106
0107 struct PyModuleDef {
0108 PyModuleDef_Base m_base;
0109 const char* m_name;
0110 const char* m_doc;
0111 Py_ssize_t m_size;
0112 PyMethodDef *m_methods;
0113 PyModuleDef_Slot *m_slots;
0114 traverseproc m_traverse;
0115 inquiry m_clear;
0116 freefunc m_free;
0117 };
0118
0119 #ifdef __cplusplus
0120 }
0121 #endif
0122 #endif