File indexing completed on 2025-01-18 10:06:49
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 #ifndef Py_LIMITED_API
0031 PyAPI_FUNC(void) _PyModule_Clear(PyObject *);
0032 PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *);
0033 PyAPI_FUNC(int) _PyModuleSpec_IsInitializing(PyObject *);
0034 #endif
0035 PyAPI_FUNC(PyModuleDef*) PyModule_GetDef(PyObject*);
0036 PyAPI_FUNC(void*) PyModule_GetState(PyObject*);
0037
0038 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
0039
0040 PyAPI_FUNC(PyObject *) PyModuleDef_Init(PyModuleDef*);
0041 PyAPI_DATA(PyTypeObject) PyModuleDef_Type;
0042 #endif
0043
0044 typedef struct PyModuleDef_Base {
0045 PyObject_HEAD
0046
0047
0048
0049
0050
0051
0052 PyObject* (*m_init)(void);
0053
0054
0055
0056
0057 Py_ssize_t m_index;
0058
0059
0060
0061
0062 PyObject* m_copy;
0063 } PyModuleDef_Base;
0064
0065 #define PyModuleDef_HEAD_INIT { \
0066 PyObject_HEAD_INIT(_Py_NULL) \
0067 _Py_NULL, \
0068 0, \
0069 _Py_NULL, \
0070 }
0071
0072 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
0073
0074 struct PyModuleDef_Slot {
0075 int slot;
0076 void *value;
0077 };
0078
0079 #define Py_mod_create 1
0080 #define Py_mod_exec 2
0081 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030c0000
0082 # define Py_mod_multiple_interpreters 3
0083 #endif
0084
0085 #ifndef Py_LIMITED_API
0086 #define _Py_mod_LAST_SLOT 3
0087 #endif
0088
0089 #endif
0090
0091
0092 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030c0000
0093 # define Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED ((void *)0)
0094 # define Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED ((void *)1)
0095 # define Py_MOD_PER_INTERPRETER_GIL_SUPPORTED ((void *)2)
0096 #endif
0097
0098 struct PyModuleDef {
0099 PyModuleDef_Base m_base;
0100 const char* m_name;
0101 const char* m_doc;
0102 Py_ssize_t m_size;
0103 PyMethodDef *m_methods;
0104 PyModuleDef_Slot *m_slots;
0105 traverseproc m_traverse;
0106 inquiry m_clear;
0107 freefunc m_free;
0108 };
0109
0110
0111
0112 #ifdef Py_BUILD_CORE
0113 extern int _PyModule_IsExtension(PyObject *obj);
0114 #endif
0115
0116 #ifdef __cplusplus
0117 }
0118 #endif
0119 #endif