PyMODINIT_FUNC initumath_tests(void) #endif { PyObject *m; PyObject *d; PyObject *version; #if defined(NPY_PY3K) m = PyModule_Create(&moduledef); #else m = Py_InitModule("umath_tests", UMath_TestsMethods); #endif if (m == NULL) return RETVAL; import_array(); import_ufunc(); d = PyModule_GetDict(m); version = PyString_FromString("0.1"); PyDict_SetItemString(d, "__version__", version); Py_DECREF(version); /* Load the ufunc operators into the module's namespace */ addUfuncs(d); if (PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "cannot load umath_tests module."); } return RETVAL; }
void initialize(bool register_scalar_converters) { wrap_import_array(); import_ufunc(); if (register_scalar_converters) dtype::register_scalar_converters(); }
PyMODINIT_FUNC init_cephes(void) { PyObject *m, *d, *s; /* Create the module and add the functions */ m = Py_InitModule("_cephes", methods); /* Import the ufunc objects */ import_array(); import_ufunc(); /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); s = PyString_FromString("2.0"); PyDict_SetItemString(d, "__version__", s); Py_DECREF(s); /* Add scipy_special_print_error_message global variable */ /* No, instead acessible through errprint */ /* Load the cephes operators into the array module's namespace */ Cephes_InitOperators(d); /* Check for errors */ if (PyErr_Occurred()) Py_FatalError("can't initialize module _cephes"); }
void init_mergesort(void) { import_array(); import_ufunc(); m = Py_InitModule3("_mergesort", module_methods, "mergesort module for parallel mergesort"); PyObject * mergefunc = PyCFunction_New(module_methods, NULL); PyObject * argmergefunc = PyCFunction_New(module_methods + 1, NULL); PyObject * permutefunc = PyCFunction_New(module_methods + 2, NULL); PyObject * reorderdtypefunc = PyCFunction_New(module_methods + 3, NULL); PyModule_AddObject(m, "merge", mergefunc); PyModule_AddObject(m, "argmerge", argmergefunc); PyModule_AddObject(m, "permute", permutefunc); PyModule_AddObject(m, "reorderdtype", reorderdtypefunc); }
static void* initialize2(bool register_scalar_converters) { init_numpy(); import_ufunc(); if (register_scalar_converters) dtype::register_scalar_converters(); }