7.5.5. Module Objects¶
There are only a few functions special to module objects.
-
PyTypeObject
PyModule_Type¶
-
int
PyModule_Check(PyObject *p)¶ Return true if p is a module object, or a subtype of a module object.
Changed in version 2.2: Allowed subtypes to be accepted.
-
int
PyModule_CheckExact(PyObject *p)¶ Return true if p is a module object, but not a subtype of
PyModule_Type.New in version 2.2.
-
int
PyModule_AddObject(PyObject *module, const char *name, PyObject *value)¶ Add an object to module as name. This is a convenience function which can be used from the module’s initialization function. This steals a reference to value. Return
-1on error,0on success.New in version 2.0.
-
int
PyModule_AddIntConstant(PyObject *module, const char *name, long value)¶ Add an integer constant to module as name. This convenience function can be used from the module’s initialization function. Return
-1on error,0on success.New in version 2.0.
-
int
PyModule_AddStringConstant(PyObject *module, const char *name, const char *value)¶ Add a string constant to module as name. This convenience function can be used from the module’s initialization function. The string value must be null-terminated. Return
-1on error,0on success.New in version 2.0.