1991-02-19 08:39:46 -04:00
|
|
|
|
1990-10-14 09:07:46 -03:00
|
|
|
/* Module object interface */
|
|
|
|
|
2000-07-08 21:55:06 -03:00
|
|
|
#ifndef Py_MODULEOBJECT_H
|
|
|
|
#define Py_MODULEOBJECT_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2002-08-12 04:21:58 -03:00
|
|
|
PyAPI_DATA(PyTypeObject) PyModule_Type;
|
1990-10-14 09:07:46 -03:00
|
|
|
|
2001-09-10 15:21:59 -03:00
|
|
|
#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
|
2020-02-13 13:37:17 -04:00
|
|
|
#define PyModule_CheckExact(op) Py_IS_TYPE(op, &PyModule_Type)
|
1990-10-14 09:07:46 -03:00
|
|
|
|
2016-12-27 08:57:39 -04:00
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
2011-03-04 08:57:07 -04:00
|
|
|
PyAPI_FUNC(PyObject *) PyModule_NewObject(
|
|
|
|
PyObject *name
|
|
|
|
);
|
2016-12-27 08:57:39 -04:00
|
|
|
#endif
|
2011-02-22 19:38:34 -04:00
|
|
|
PyAPI_FUNC(PyObject *) PyModule_New(
|
|
|
|
const char *name /* UTF-8 encoded string */
|
|
|
|
);
|
2002-08-12 04:21:58 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
|
2016-12-27 08:57:39 -04:00
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
2011-02-22 20:21:43 -04:00
|
|
|
PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *);
|
2016-12-27 08:57:39 -04:00
|
|
|
#endif
|
2007-08-25 23:21:42 -03:00
|
|
|
PyAPI_FUNC(const char *) PyModule_GetName(PyObject *);
|
2019-05-28 12:16:33 -03:00
|
|
|
Py_DEPRECATED(3.2) PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
|
2010-08-17 20:37:11 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *);
|
2010-12-03 16:14:31 -04:00
|
|
|
#ifndef Py_LIMITED_API
|
2002-08-12 04:21:58 -03:00
|
|
|
PyAPI_FUNC(void) _PyModule_Clear(PyObject *);
|
2014-02-10 12:21:34 -04:00
|
|
|
PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *);
|
2018-10-30 08:19:51 -03:00
|
|
|
PyAPI_FUNC(int) _PyModuleSpec_IsInitializing(PyObject *);
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif
|
2008-06-11 02:26:20 -03:00
|
|
|
PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*);
|
|
|
|
PyAPI_FUNC(void*) PyModule_GetState(PyObject*);
|
|
|
|
|
2015-06-02 20:06:47 -03:00
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
|
|
|
/* New in 3.5 */
|
2015-05-23 09:24:10 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyModuleDef_Init(struct PyModuleDef*);
|
2015-05-23 18:44:37 -03:00
|
|
|
PyAPI_DATA(PyTypeObject) PyModuleDef_Type;
|
2015-06-02 20:06:47 -03:00
|
|
|
#endif
|
2015-05-23 09:24:10 -03:00
|
|
|
|
2008-06-11 02:26:20 -03:00
|
|
|
typedef struct PyModuleDef_Base {
|
|
|
|
PyObject_HEAD
|
|
|
|
PyObject* (*m_init)(void);
|
|
|
|
Py_ssize_t m_index;
|
|
|
|
PyObject* m_copy;
|
|
|
|
} PyModuleDef_Base;
|
|
|
|
|
2010-11-17 17:20:18 -04:00
|
|
|
#define PyModuleDef_HEAD_INIT { \
|
|
|
|
PyObject_HEAD_INIT(NULL) \
|
|
|
|
NULL, /* m_init */ \
|
|
|
|
0, /* m_index */ \
|
|
|
|
NULL, /* m_copy */ \
|
|
|
|
}
|
2008-06-11 02:26:20 -03:00
|
|
|
|
2015-06-02 20:06:47 -03:00
|
|
|
struct PyModuleDef_Slot;
|
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
|
|
|
/* New in 3.5 */
|
2015-05-23 09:24:10 -03:00
|
|
|
typedef struct PyModuleDef_Slot{
|
|
|
|
int slot;
|
|
|
|
void *value;
|
|
|
|
} PyModuleDef_Slot;
|
|
|
|
|
2015-06-02 20:06:47 -03:00
|
|
|
#define Py_mod_create 1
|
|
|
|
#define Py_mod_exec 2
|
|
|
|
|
|
|
|
#ifndef Py_LIMITED_API
|
|
|
|
#define _Py_mod_LAST_SLOT 2
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* New in 3.5 */
|
|
|
|
|
2008-06-11 02:26:20 -03:00
|
|
|
typedef struct PyModuleDef{
|
|
|
|
PyModuleDef_Base m_base;
|
|
|
|
const char* m_name;
|
|
|
|
const char* m_doc;
|
|
|
|
Py_ssize_t m_size;
|
|
|
|
PyMethodDef *m_methods;
|
2015-06-02 20:06:47 -03:00
|
|
|
struct PyModuleDef_Slot* m_slots;
|
2008-06-11 02:26:20 -03:00
|
|
|
traverseproc m_traverse;
|
|
|
|
inquiry m_clear;
|
|
|
|
freefunc m_free;
|
2016-08-21 04:41:56 -03:00
|
|
|
} PyModuleDef;
|
2008-06-11 02:26:20 -03:00
|
|
|
|
1993-07-28 06:05:47 -03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_MODULEOBJECT_H */
|