X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/2135a6d38fafd669e214e93b99bc1e4c0867cca0..aaf8c7aa5f90b6d58c0ee317e19976972eee39ba:/catacomb.c diff --git a/catacomb.c b/catacomb.c index c1e91ff..b3d7e52 100644 --- a/catacomb.c +++ b/catacomb.c @@ -321,7 +321,22 @@ static void init_random(void) #endif } -EXPORT void init_base(void) +#ifdef PY3 +static PyModuleDef moddef = { + PyModuleDef_HEAD_INIT, + "catacomb._base", /* @m_name@ */ + "Low-level module for Catacomb bindings. Use `catacomb' instead.", + /* @m_doc@ */ + 0, /* @m_size@ */ + 0, /* @m_methods@ */ + 0, /* @m_slots@ */ + 0, /* @m_traverse@ */ + 0, /* @m_clear@ */ + 0 /* @m_free@ */ +}; +#endif + +EXPORT PyMODINIT_FUNC PY23(init_base, PyInit__base)(void) { PyObject *mod; @@ -330,10 +345,18 @@ EXPORT void init_base(void) INIT_MODULES; INITTYPE(thingtab, root); init_random(); +#ifdef PY3 + moddef.m_methods = donemethods(); + mod = PyModule_Create(&moddef); +#else mod = Py_InitModule("catacomb._base", donemethods()); +#endif INSERT_MODULES; INSERT("_MiscTable", thingtab_pytype); INSERT("smallprimes", smallprimes()); +#ifdef PY3 + return (mod); +#endif } /*----- That's all, folks -------------------------------------------------*/