PyMODINIT_FUNC init_journal(void) { PyObject *m; m = Py_InitModule("_journal", methods); if (m == NULL) return; PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION); }
/* PYTHON MODULE EXPORTS */ _DLLEXPORT_ void initdistorm() { PyObject* distormModule = Py_InitModule3("distorm", distormModulebMethods, ":[diStorm64}:"); PyModule_AddIntConstant(distormModule, "Decode16Bits", Decode16Bits); PyModule_AddIntConstant(distormModule, "Decode32Bits", Decode32Bits); PyModule_AddIntConstant(distormModule, "Decode64Bits", Decode64Bits); PyModule_AddIntConstant(distormModule, "OffsetTypeSize", sizeof(_OffsetType) * 8); PyModule_AddStringConstant(distormModule, "info", ":[diStorm64 1.7.30}:\r\nCopyright RageStorm (C) 2008, Gil Dabah \r\n\r\ndiStorm is licensed under the BSD license.\r\nhttp://ragestorm.net/distorm/\r\n"); }
PyMODINIT_FUNC PyInit__csv(void) { PyObject *module; const StyleDesc *style; if (PyType_Ready(&Dialect_Type) < 0) return NULL; if (PyType_Ready(&Reader_Type) < 0) return NULL; if (PyType_Ready(&Writer_Type) < 0) return NULL; /* Create the module and add the functions */ module = PyModule_Create(&_csvmodule); if (module == NULL) return NULL; /* Add version to the module. */ if (PyModule_AddStringConstant(module, "__version__", MODULE_VERSION) == -1) return NULL; /* Set the field limit */ _csvstate(module)->field_limit = 128 * 1024; /* Do I still need to add this var to the Module Dict? */ /* Add _dialects dictionary */ _csvstate(module)->dialects = PyDict_New(); if (_csvstate(module)->dialects == NULL) return NULL; Py_INCREF(_csvstate(module)->dialects); if (PyModule_AddObject(module, "_dialects", _csvstate(module)->dialects)) return NULL; /* Add quote styles into dictionary */ for (style = quote_styles; style->name; style++) { if (PyModule_AddIntConstant(module, style->name, style->style) == -1) return NULL; } /* Add the Dialect type */ Py_INCREF(&Dialect_Type); if (PyModule_AddObject(module, "Dialect", (PyObject *)&Dialect_Type)) return NULL; /* Add the CSV exception object to the module. */ _csvstate(module)->error_obj = PyErr_NewException("_csv.Error", NULL, NULL); if (_csvstate(module)->error_obj == NULL) return NULL; Py_INCREF(_csvstate(module)->error_obj); PyModule_AddObject(module, "Error", _csvstate(module)->error_obj); return module; }
PyMODINIT_FUNC init_nk20(void) { PyObject* m; import_array(); import_pyk_k20(); m = Py_InitModule3("_nk20", funcs, doc); PyModule_AddStringConstant(m, "__version__", __version__); }
// Initialization void initpydeep(void) { PyObject *pydeep; pydeep = Py_InitModule3("pydeep", pydeepMethods, "C/Python bindings for ssdeep [ssdeep.sourceforge.net]"); pydeepError = PyErr_NewException("pydeep.Error", NULL, NULL); Py_INCREF(pydeepError); PyModule_AddObject(pydeep, "error", pydeepError); PyModule_AddStringConstant(pydeep, "__version__", PYDEEP_VERSION); }
PyObject * _PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp) { PyObject *m; char *lastdot, *shortname, *packagecontext, *oldcontext; dl_funcptr p; if ((m = _PyImport_FindExtension(name, pathname)) != NULL) { Py_INCREF(m); return m; } lastdot = strrchr(name, '.'); if (lastdot == NULL) { packagecontext = NULL; shortname = name; } else { packagecontext = name; shortname = lastdot+1; } p = _PyImport_GetDynLoadFunc(name, shortname, pathname, fp); if (PyErr_Occurred()) return NULL; if (p == NULL) { PyErr_Format(PyExc_ImportError, "dynamic module does not define init function (init%.200s)", shortname); return NULL; } oldcontext = _Py_PackageContext; _Py_PackageContext = packagecontext; (*p)(); _Py_PackageContext = oldcontext; if (PyErr_Occurred()) return NULL; m = PyDict_GetItemString(PyImport_GetModuleDict(), name); if (m == NULL) { PyErr_SetString(PyExc_SystemError, "dynamic module not initialized properly"); return NULL; } /* Remember the filename as the __file__ attribute */ if (PyModule_AddStringConstant(m, "__file__", pathname) < 0) PyErr_Clear(); /* Not important enough to report */ if (_PyImport_FixupExtension(name, pathname) == NULL) return NULL; if (Py_VerboseFlag) PySys_WriteStderr( "import %s # dynamically loaded from %s\n", name, pathname); Py_INCREF(m); return m; }
PyMODINIT_FUNC initcqsl(void) { PyObject *m; m = Py_InitModule3("cqsl", cqsl_methods, cqsl_doc); if (m == NULL) return; PyModule_AddStringConstant(m, "__version__", "1.0"); }
PyMODINIT_FUNC init_daemon(void) { PyObject *m; m = Py_InitModule3("_daemon", methods, module__doc__); if (m == NULL) return; PyModule_AddIntConstant(m, "LISTEN_FDS_START", SD_LISTEN_FDS_START); PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION); }
PyMODINIT_FUNC InitAddonModule(void) { Py_INCREF(&Addon_Type); // init general xbmcaddon modules PyObject* pXbmcAddonModule; pXbmcAddonModule = Py_InitModule((char*)"xbmcaddon", xbmcAddonMethods); if (pXbmcAddonModule == NULL) return; PyModule_AddObject(pXbmcAddonModule, (char*)"Addon", (PyObject*)&Addon_Type); // constants PyModule_AddStringConstant(pXbmcAddonModule, (char*)"__author__", (char*)PY_XBMC_AUTHOR); PyModule_AddStringConstant(pXbmcAddonModule, (char*)"__date__", (char*)"1 May 2010"); PyModule_AddStringConstant(pXbmcAddonModule, (char*)"__version__", (char*)"1.0"); PyModule_AddStringConstant(pXbmcAddonModule, (char*)"__credits__", (char*)PY_XBMC_CREDITS); PyModule_AddStringConstant(pXbmcAddonModule, (char*)"__platform__", (char*)PY_XBMC_PLATFORM); }
PyMODINIT_FUNC init_csv(void) { PyObject *module; StyleDesc *style; if (PyType_Ready(&Dialect_Type) < 0) return; if (PyType_Ready(&Reader_Type) < 0) return; if (PyType_Ready(&Writer_Type) < 0) return; /* Create the module and add the functions */ module = Py_InitModule3("_csv", csv_methods, csv_module_doc); if (module == NULL) return; /* Add version to the module. */ if (PyModule_AddStringConstant(module, "__version__", MODULE_VERSION) == -1) return; /* Add _dialects dictionary */ dialects = PyDict_New(); if (dialects == NULL) return; if (PyModule_AddObject(module, "_dialects", dialects)) return; /* Add quote styles into dictionary */ for (style = quote_styles; style->name; style++) { if (PyModule_AddIntConstant(module, style->name, style->style) == -1) return; } /* Add the Dialect type */ Py_INCREF(&Dialect_Type); if (PyModule_AddObject(module, "Dialect", (PyObject *)&Dialect_Type)) return; /* Add the CSV exception object to the module. */ error_obj = PyErr_NewException("_csv.Error", NULL, NULL); if (error_obj == NULL) return; // Pyston change: I *think* an incref is needed here, but it doesn't matter in CPython since they don't // try to tear down builtin classes: Py_INCREF(error_obj); PyModule_AddObject(module, "Error", error_obj); }
initsound(void) { Py_Initialize(); PyObject *m= Py_InitModule(MODULE_NAME, pysound_methods); // Initialize tables PyModule_AddStringConstant(m, "__doc__", PYMODULEDOC ); PyModule_AddStringConstant(m, "version", PYSNDVERSION ); PyModule_AddIntConstant(m, "build", PYSNDBUILD ); _EXPORT_INT(m, AFMT_MU_LAW); _EXPORT_INT(m, AFMT_A_LAW); _EXPORT_INT(m, AFMT_IMA_ADPCM); _EXPORT_INT(m, AFMT_U8); _EXPORT_INT(m, AFMT_S16_LE); _EXPORT_INT(m, AFMT_S16_BE); _EXPORT_INT(m, AFMT_S8); _EXPORT_INT(m, AFMT_U16_LE); _EXPORT_INT(m, AFMT_U16_BE); _EXPORT_INT(m, AFMT_MPEG); _EXPORT_INT(m, AFMT_AC3); _EXPORT_INT(m, AFMT_S16_NE); g_cErr = PyErr_NewException(MODULE_NAME".SoundError", NULL, NULL); if( g_cErr != NULL) PyModule_AddObject(m, "SoundError", g_cErr ); PyISoundType.ob_type = &PyType_Type; Py_INCREF((PyObject *)&PyISoundType); PyModule_AddObject(m, INPUT_NAME, (PyObject *)&PyISoundType); PySoundType.ob_type = &PyType_Type; Py_INCREF((PyObject *)&PySoundType); PyModule_AddObject(m, OUTPUT_NAME, (PyObject *)&PySoundType); ResamplerType.ob_type = &PyType_Type; Py_INCREF((PyObject *)&ResamplerType); PyModule_AddObject(m, RESAMPLER_NAME, (PyObject *)&ResamplerType); AnalyzerType.ob_type = &PyType_Type; Py_INCREF((PyObject *)&AnalyzerType); PyModule_AddObject(m, ANALYZER_NAME, (PyObject *)&AnalyzerType); MixerType.ob_type = &PyType_Type; Py_INCREF((PyObject *)&MixerType); PyModule_AddObject(m, MIXER_NAME, (PyObject *)&MixerType); }
extern PyMODINIT_FUNC initscamurmur3(void) { PyObject *m; m = Py_InitModule3("scamurmur3", scamurmur3_methods, module_doc); if (m == NULL) return; PyModule_AddStringConstant(m, "__version__", MODULE_VERSION); }
initcd(void) { Py_Initialize(); g_iMaxCDROMIndex= -1; PyObject *m = Py_InitModule("cd", pycd_methods); PyModule_AddStringConstant( m, "__doc__", (char*)PYDOC ); PyModule_AddStringConstant( m, "version", (char*)PYCDVERSION ); PyModule_AddIntConstant( m, "build", PYCDBUILD ); INT_CONSTANT( SEEK_SET ); INT_CONSTANT( SEEK_END ); INT_CONSTANT( SEEK_CUR ); g_cErr = PyErr_NewException(MODULE_NAME".CDError", NULL, NULL); if( g_cErr != NULL) PyModule_AddObject(m, "CDError", g_cErr ); PyCDType.ob_type = &PyType_Type; Py_INCREF((PyObject *)&PyCDType); PyModule_AddObject(m, "CD", (PyObject *)&PyCDType); }
PyObject *init_guava(void) { PyObject *guava_module = NULL; PyObject *request_module = NULL; PyObject *server_module = NULL; PyObject *handler_module = NULL; PyObject *controller_module = NULL; PyObject *router_module = NULL; PyObject *session_module = NULL; PyObject *cookie_module = NULL; PyEval_InitThreads(); guava_module = Py_InitModule("guava", NULL); request_module = init_request(); if (!register_module(guava_module, "request", request_module)) { return NULL; } server_module = init_server(); if (!register_module(guava_module, "server", server_module)) { return NULL; } handler_module = init_handler(); if (!register_module(guava_module, "handler", handler_module)) { return NULL; } router_module = init_router(); if (!register_module(guava_module, "router", router_module)) { return NULL; } controller_module = init_controller(); if (!register_module(guava_module, "controller", controller_module)) { return NULL; } session_module = init_session(); if (!register_module(guava_module, "session", session_module)) { return NULL; } cookie_module = init_cookie(); if (!register_module(guava_module, "cookie", cookie_module)) { return NULL; } PyModule_AddStringConstant(guava_module, "version", GUAVA_VERSION); return guava_module; }
void init_aes(PyObject*const module) { if (PyType_Ready(&AES_type) < 0) return; Py_INCREF(&AES_type); PyModule_AddObject(module, "aes_AES", (PyObject *)&AES_type); aes_error = PyErr_NewException(const_cast<char*>("_aes.Error"), NULL, NULL); PyModule_AddObject(module, "aes_Error", aes_error); PyModule_AddStringConstant(module, "aes___doc__", const_cast<char*>(aes___doc__)); }
PyMODINIT_FUNC MODINIT2(void) { PyObject *m; m = Py_InitModule(SPONGE_MODULE, NULL); if (m == NULL) return; PyModule_AddStringConstant(m, "__doc__", mod_doc); mod_init(m); }
PyMODINIT_FUNC initid128(void) { PyObject *m; m = Py_InitModule3("id128", methods, module__doc__); if (m == NULL) return; /* a series of lines like 'add_id() ;' follow */ #define JOINER ; #include "id128-constants.h" #undef JOINER PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION); }
extern PyMODINIT_FUNC PyInit_smhasher(void) { PyObject *m; m = PyModule_Create(&smhasher_module); if (m == NULL) goto finally; PyModule_AddStringConstant(m, "__version__", MODULE_VERSION); finally: return m; }
void gimpthumb_add_constants(PyObject *module, const gchar *strip_prefix) { #ifdef VERSION PyModule_AddStringConstant(module, "__version__", VERSION); #endif pyg_enum_add(module, "ThumbFileType", strip_prefix, GIMP_TYPE_THUMB_FILE_TYPE); pyg_enum_add(module, "ThumbSize", strip_prefix, GIMP_TYPE_THUMB_SIZE); pyg_enum_add(module, "ThumbState", strip_prefix, GIMP_TYPE_THUMB_STATE); if (PyErr_Occurred()) PyErr_Print(); }
int get_and_load_rules(struct rules_motor_env_s** me, const gchar *ns_name){ int rc; GByteArray *mod_in_string = NULL; PyObject *py_main = NULL; GError *err = NULL; /* Free previous module and function in 'me' */ if ((*me)->py_function != NULL) { Py_XDECREF((*me)->py_function); (*me)->py_function = NULL; } if ((*me)->py_module != NULL) { Py_XDECREF((*me)->py_module); (*me)->py_module = NULL; } /* Get rule script from conscience */ mod_in_string = namespace_get_rules(ns_name, CHUNK_CRAWLER, &err); if(mod_in_string == NULL){ ERROR("Failed to fetch rules : %s", err->message); g_clear_error (&err); return -1; } PyRun_SimpleString("import imp"); PyRun_SimpleString("rules_mod = imp.new_module('rules_mod')"); py_main = PyImport_AddModule("__main__"); rc = PyModule_AddStringConstant(py_main, "mod_in_string", (char *)mod_in_string->data); g_byte_array_free(mod_in_string, TRUE); if(rc == -1){ ERROR("Failed to import rules(GByteArray) into python environment"); return -1; } PyRun_SimpleString("exec mod_in_string in rules_mod.__dict__"); (*me)->py_module = PyObject_GetAttrString(py_main, "rules_mod"); if((*me)->py_module == NULL){ ERROR("Failed to load python module"); return -1; } (*me)->py_function = PyObject_GetAttrString((*me)->py_module, "main"); if((*me)->py_function == NULL){ ERROR("Failed to get python function hook"); return -1; } return 1; }
PyMODINIT_FUNC initmisaka(void) #endif { #if PY_MAJOR_VERSION >= 3 PyObject *module = PyModule_Create(&moduledef); #else PyObject *module = Py_InitModule3("misaka", misaka_methods, misaka_module__doc__); #endif if (module == NULL) { INITERROR; } struct module_state *st = GETSTATE(module); st->error = PyErr_NewException("misaka.Error", NULL, NULL); if (st->error == NULL) { Py_DECREF(module); INITERROR; } /* Version */ PyModule_AddStringConstant(module, "__version__", "0.3.2"); /* Markdown extensions */ PyModule_AddIntConstant(module, "EXT_NO_INTRA_EMPHASIS", MKDEXT_NO_INTRA_EMPHASIS); PyModule_AddIntConstant(module, "EXT_TABLES", MKDEXT_TABLES); PyModule_AddIntConstant(module, "EXT_FENCED_CODE", MKDEXT_FENCED_CODE); PyModule_AddIntConstant(module, "EXT_AUTOLINK", MKDEXT_AUTOLINK); PyModule_AddIntConstant(module, "EXT_STRIKETHROUGH", MKDEXT_STRIKETHROUGH); PyModule_AddIntConstant(module, "EXT_LAX_HTML_BLOCKS", MKDEXT_LAX_HTML_BLOCKS); PyModule_AddIntConstant(module, "EXT_SPACE_HEADERS", MKDEXT_SPACE_HEADERS); /* XHTML Render flags */ PyModule_AddIntConstant(module, "HTML_SKIP_HTML", HTML_SKIP_HTML); PyModule_AddIntConstant(module, "HTML_SKIP_STYLE", HTML_SKIP_STYLE); PyModule_AddIntConstant(module, "HTML_SKIP_IMAGES", HTML_SKIP_IMAGES); PyModule_AddIntConstant(module, "HTML_SKIP_LINKS", HTML_SKIP_LINKS); PyModule_AddIntConstant(module, "HTML_EXPAND_TABS", HTML_EXPAND_TABS); PyModule_AddIntConstant(module, "HTML_SAFELINK", HTML_SAFELINK); PyModule_AddIntConstant(module, "HTML_TOC", HTML_TOC); PyModule_AddIntConstant(module, "HTML_HARD_WRAP", HTML_HARD_WRAP); PyModule_AddIntConstant(module, "HTML_GITHUB_BLOCKCODE", HTML_GITHUB_BLOCKCODE); PyModule_AddIntConstant(module, "HTML_USE_XHTML", HTML_USE_XHTML); PyModule_AddIntConstant(module, "HTML_SMARTYPANTS", HTML_SMARTYPANTS); #if PY_MAJOR_VERSION >= 3 return module; #endif }
initflowd(void) { PyObject *m; if (PyType_Ready(&Flow_Type) < 0) return; if (PyType_Ready(&FlowLog_Type) < 0) return; m = Py_InitModule3("flowd", flowd_methods, module_doc); #define STORE_CONST(c) \ PyModule_AddObject(m, #c, PyLong_FromUnsignedLong(STORE_##c)) STORE_CONST(FIELD_TAG); STORE_CONST(FIELD_RECV_TIME); STORE_CONST(FIELD_PROTO_FLAGS_TOS); STORE_CONST(FIELD_AGENT_ADDR4); STORE_CONST(FIELD_AGENT_ADDR6); STORE_CONST(FIELD_SRC_ADDR4); STORE_CONST(FIELD_SRC_ADDR6); STORE_CONST(FIELD_DST_ADDR4); STORE_CONST(FIELD_DST_ADDR6); STORE_CONST(FIELD_GATEWAY_ADDR4); STORE_CONST(FIELD_GATEWAY_ADDR6); STORE_CONST(FIELD_SRCDST_PORT); STORE_CONST(FIELD_PACKETS); STORE_CONST(FIELD_OCTETS); STORE_CONST(FIELD_IF_INDICES); STORE_CONST(FIELD_AGENT_INFO); STORE_CONST(FIELD_FLOW_TIMES); STORE_CONST(FIELD_AS_INFO); STORE_CONST(FIELD_FLOW_ENGINE_INFO); STORE_CONST(FIELD_CRC32); STORE_CONST(FIELD_RESERVED); STORE_CONST(FIELD_ALL); STORE_CONST(FIELD_AGENT_ADDR); STORE_CONST(FIELD_SRC_ADDR); STORE_CONST(FIELD_DST_ADDR); STORE_CONST(FIELD_SRCDST_ADDR); STORE_CONST(FIELD_GATEWAY_ADDR); STORE_CONST(DISPLAY_ALL); STORE_CONST(DISPLAY_BRIEF); #undef STORE_CONST #define STORE_CONST2(c) \ PyModule_AddObject(m, "STORE_"#c, PyLong_FromUnsignedLong(STORE_##c)) STORE_CONST2(VER_MAJOR); STORE_CONST2(VER_MINOR); STORE_CONST2(VERSION); #undef STORE_CONST2 PyModule_AddStringConstant(m, "__version__", PROGVER); }
int python_initialize() { PyObject *ekg, *ekg_config; /* PyImport_ImportModule spodziewa siê nazwy modu³u, który znajduje * siê w $PYTHONPATH, wiêc dodajemy tam katalog ~/.gg/scripts. mo¿na * to zrobiæ w bardziej elegancki sposób, ale po co komplikowaæ sobie * ¿ycie? * * Argument putenv() nie jest zwalniany xfree(), bo powoduje to * problemy na systemach, w których putenv() jest zgodne z SUSv2 (np * niektóre SunOS). */ if (getenv("PYTHONPATH")) { char *tmp = saprintf("%s:%s", getenv("PYTHONPATH"), prepare_path("scripts", 0)); #ifdef HAVE_SETENV setenv("PYTHONPATH", tmp, 1); #else { char *s = saprintf("PYTHONPATH=%s", tmp); putenv(s); } #endif xfree(tmp); } else { #ifdef HAVE_SETENV setenv("PYTHONPATH", prepare_path("scripts", 0), 1); #else { char *s = saprintf("PYTHONPATH=%s", prepare_path("scripts", 0)); putenv(s); } #endif } Py_Initialize(); PyImport_AddModule("ekg"); if (!(ekg = Py_InitModule("ekg", ekg_methods))) return -1; PyModule_AddStringConstant(ekg, "version", VERSION); ekg_config = PyObject_NEW(PyObject, &ekg_config_type); PyModule_AddObject(ekg, "config", ekg_config); return 0; }
PyMODINIT_FUNC initsnudown(void) { PyObject *module; module = Py_InitModule3("snudown", snudown_methods, snudown_module__doc__); if (module == NULL) return; init_default_renderer(module); init_wiki_renderer(module); /* Version */ PyModule_AddStringConstant(module, "__version__", SNUDOWN_VERSION); }
PyMODINIT_FUNC init_csv(void) { PyObject *module; StyleDesc *style; if (PyType_Ready(&Dialect_Type) < 0) return; if (PyType_Ready(&Reader_Type) < 0) return; if (PyType_Ready(&Writer_Type) < 0) return; /* Create the module and add the functions */ module = Py_InitModule3("_csv", csv_methods, csv_module_doc); if (module == NULL) return; /* Add version to the module. */ if (PyModule_AddStringConstant(module, "__version__", MODULE_VERSION) == -1) return; /* Add _dialects dictionary */ dialects = PyGC_AddRoot(PyDict_New()); if (dialects == NULL) return; if (PyModule_AddObject(module, "_dialects", dialects)) return; /* Add quote styles into dictionary */ for (style = quote_styles; style->name; style++) { if (PyModule_AddIntConstant(module, style->name, style->style) == -1) return; } /* Add the Dialect type */ Py_INCREF(&Dialect_Type); if (PyModule_AddObject(module, "Dialect", (PyObject *)&Dialect_Type)) return; /* Add the CSV exception object to the module. */ error_obj = PyGC_AddRoot(PyErr_NewException("_csv.Error", NULL, NULL)); if (error_obj == NULL) return; PyModule_AddObject(module, "Error", error_obj); }
PyMODINIT_FUNC PyInit__journal(void) { PyObject *m; m = PyModule_Create(&module); if (m == NULL) return NULL; if (PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION)) { Py_DECREF(m); return NULL; } return m; }
PyMODINIT_FUNC inittypes ( void ) { PyObject * module = 0; if ( ! ( module = Py_InitModule3 ( "fudgepyc.types", module_methods, DOC_fudgepyc_typesmodule ) ) ) return; PyModule_AddStringConstant ( module, "__version__", fudgepyc_version ); if ( fudgepyc_typesAddModuleAttrs ( module, "TYPE_NAMES", module_typeattrs ) || fudgepyc_typesAddModuleAttrs ( module, "PRECISION_NAMES", module_precisionattrs ) ) return; }
PyMODINIT_FUNC initbarcode (void) { PyObject *m; BarcodeType.tp_new = PyType_GenericNew; if (PyType_Ready (&BarcodeType) < 0) return; m = Py_InitModule3 ("spam", spam_methods, "Testing"); Py_INCREF (&BarcodeType); PyModule_AddObject (m, "Spam", (PyObject *) &SpamType); PyModule_AddStringConstant (m, "MODULE_VERSION", "0.0.0.1"); }
PyMODINIT_FUNC initfinalCleanup(void) { PyObject *m; m = Py_InitModule3("finalCleanup", finalCleanup_methods, module_doc); if (m == NULL) { printf("Null value in init\n"); exit(2); //return NULL; } PyModule_AddStringConstant(m, "__version__", FINALCLEANUP_VERSION); }
PyMODINIT_FUNC init_wrtctl_const( void ){ PyObject *module = NULL; const_map_t emi; if ( !(module = Py_InitModule("_wrtctl_const", NULL)) ) return; for ( emi = constants_map; emi->name; emi++ ){ if ( emi->val != -1 ) PyModule_AddIntConstant(module, emi->name, emi->val); else PyModule_AddStringConstant(module, emi->name, emi->str); } return; }