From 1fc4a731d50397406b5d5801476db6a56e5d8eb8 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 6 Dec 2009 12:05:10 +0000 Subject: 3K: module inits for all core modules --- numpy/core/src/scalarmathmodule.c.src | 36 ++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'numpy/core/src/scalarmathmodule.c.src') diff --git a/numpy/core/src/scalarmathmodule.c.src b/numpy/core/src/scalarmathmodule.c.src index 00dc8e1f4..d2be8d69c 100644 --- a/numpy/core/src/scalarmathmodule.c.src +++ b/numpy/core/src/scalarmathmodule.c.src @@ -1475,14 +1475,44 @@ static struct PyMethodDef methods[] = { {NULL, NULL, 0, NULL} }; -PyMODINIT_FUNC initscalarmath(void) { +#if defined(NPY_PY3K) +static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + "scalarmath", + NULL, + -1, + methods, + NULL, + NULL, + NULL, + NULL +}; +#endif + +#if defined(NPY_PY3K) +#define RETVAL m +PyObject *PyInit_scalarmath(void) +#else +#define RETVAL +PyMODINIT_FUNC +initscalarmath(void) +#endif +{ + PyObject *m; +#if defined(NPY_PY3K) + m = PyModule_Create(&moduledef); + if (!m) { + return NULL; + } +#else Py_InitModule("scalarmath", methods); +#endif import_array(); import_umath(); - if (get_functions() < 0) return; + if (get_functions() < 0) return RETVAL; add_scalarmath(); @@ -1504,5 +1534,5 @@ PyMODINIT_FUNC initscalarmath(void) { #endif saved_tables[8] = PyComplex_Type.tp_richcompare; - return; + return RETVAL; } -- cgit v1.2.1