diff options
author | Pauli Virtanen <pav@iki.fi> | 2009-12-06 12:05:10 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2009-12-06 12:05:10 +0000 |
commit | 1fc4a731d50397406b5d5801476db6a56e5d8eb8 (patch) | |
tree | e3ef2859f21f21683c8ea76cfb96d759ee5839d4 /numpy/core/src/scalarmathmodule.c.src | |
parent | 816035e8881f19437b7f1d08b30e48cf4adac278 (diff) | |
download | numpy-1fc4a731d50397406b5d5801476db6a56e5d8eb8.tar.gz |
3K: module inits for all core modules
Diffstat (limited to 'numpy/core/src/scalarmathmodule.c.src')
-rw-r--r-- | numpy/core/src/scalarmathmodule.c.src | 36 |
1 files changed, 33 insertions, 3 deletions
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; } |