From: Mark Wooding Date: Sun, 20 Oct 2019 16:57:11 +0000 (+0100) Subject: catacomb.c, util.c: Export `modname' and set it in main entry point. X-Git-Url: https://git.distorted.org.uk/~mdw/pyke/commitdiff_plain/c6a36308d930f04e4cce57b319d9ea6628fc3f4c catacomb.c, util.c: Export `modname' and set it in main entry point. This is preliminary work in splitting out the Catacomb-independent utilities so that they can be used by other projects. --- diff --git a/catacomb-python.h b/catacomb-python.h index 5638812..fe64aeb 100644 --- a/catacomb-python.h +++ b/catacomb-python.h @@ -185,6 +185,7 @@ PRIVATE_SYMBOLS; #define INITTYPE(ty, base) INITTYPE_META(ty, base, type) extern PyObject *home_module; +extern PyObject *modname; #define INSERT(name, ob) do { \ PyObject *_o = (PyObject *)(ob); \ diff --git a/catacomb.c b/catacomb.c index bb0bbdb..bf68727 100644 --- a/catacomb.c +++ b/catacomb.c @@ -174,6 +174,8 @@ static void init_random(void) EXPORT void init_base(void) { PyObject *mod; + + modname = PyString_FromString("catacomb"); addmethods(methods); INIT_MODULES; init_random(); diff --git a/util.c b/util.c index aa75ea7..55de789 100644 --- a/util.c +++ b/util.c @@ -32,7 +32,7 @@ /*----- External values ---------------------------------------------------*/ -static PyObject *modname = 0; +PyObject *modname = 0; PyObject *home_module = 0; /*----- Conversions -------------------------------------------------------*/ @@ -852,7 +852,6 @@ static const PyMethodDef methods[] = { void util_pyinit(void) { - modname = PyString_FromString("catacomb"); INITTYPE(itemiter, root); INITTYPE(valiter, root); addmethods(methods);