3.9. Module API#

PyModuleDef CpModule;#

Global module object for the Caterpillar C module.

inline _modulestate *get_module_state(PyObject *module)#

Returns the _modulestate for the given module.

inline _modulestate *get_global_module_state(void)#

Returns the _modulestate using the global caterpillar module object.

struct _modulestate#

The internal state for this module. It will store all necessary information about the core module: cached architecture/endian singleton objects and interned strings used by atom, context, stream, and struct helpers. The state is owned by the extension module and should be accessed through get_module_state() or get_global_module_state().

CpModule_SetupType(op, ret)#

Sets up the type object for the given module object. Expands to:

if (PyType_Ready(op) < 0)
    return (ret);