chiark / gitweb /
catacomb.c, util.c: Export `modname' and set it in main entry point.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 20 Oct 2019 16:57:11 +0000 (17:57 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 10 Apr 2020 21:42:39 +0000 (22:42 +0100)
This is preliminary work in splitting out the Catacomb-independent
utilities so that they can be used by other projects.

catacomb-python.h
catacomb.c
util.c

index 5638812dde6c479fc8e9ec4f317cf831bcc044ba..fe64aebd3cc08a3a60121ef133be28194ec0ac44 100644 (file)
@@ -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);                                     \
index bb0bbdbcec1d8f7e6154a206c78b127184ad6a41..bf68727bc4cb51d8e15e9b8319f599d7f87819e5 100644 (file)
@@ -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 aa75ea7a8bb0ea06cff575e0e46708bc38feb7fc..55de78925032541a860425c03e34a25f3eaf761a 100644 (file)
--- 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);