summaryrefslogtreecommitdiff
path: root/numpy/core/blasdot
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2010-08-04 19:40:55 +0000
committerPauli Virtanen <pav@iki.fi>2010-08-04 19:40:55 +0000
commita18e3e6912b451461c6e844798c4b2346d455346 (patch)
tree268899340b3186abc99cfb8be340ab07c341ade2 /numpy/core/blasdot
parent7eb6fa7befe4898e50993fc93a44389afe784d5e (diff)
downloadnumpy-a18e3e6912b451461c6e844798c4b2346d455346.tar.gz
3K: fix core/dotblas module initialization.
Diffstat (limited to 'numpy/core/blasdot')
-rw-r--r--numpy/core/blasdot/_dotblas.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/numpy/core/blasdot/_dotblas.c b/numpy/core/blasdot/_dotblas.c
index 2b3e5ad4f..1dc24d8ea 100644
--- a/numpy/core/blasdot/_dotblas.c
+++ b/numpy/core/blasdot/_dotblas.c
@@ -2,6 +2,7 @@ static char module_doc[] =
"This module provides a BLAS optimized\nmatrix multiply, inner product and dot for numpy arrays";
#include "Python.h"
+#include "npy_config.h"
#include "numpy/ndarrayobject.h"
#ifndef CBLAS_HEADER
#define CBLAS_HEADER "cblas.h"
@@ -1174,13 +1175,38 @@ static struct PyMethodDef dotblas_module_methods[] = {
{NULL, NULL, 0, NULL} /* sentinel */
};
+#if defined(NPY_PY3K)
+static struct PyModuleDef moduledef = {
+ PyModuleDef_HEAD_INIT,
+ "_dotblas",
+ NULL,
+ -1,
+ dotblas_module_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+#endif
+
/* Initialization function for the module */
-PyMODINIT_FUNC init_dotblas(void) {
+#if defined(NPY_PY3K)
+#define RETVAL m
+PyObject *PyInit__dotblas(void)
+#else
+#define RETVAL
+PyMODINIT_FUNC init_dotblas(void)
+#endif
+{
int i;
- PyObject *d, *s;
+ PyObject *d, *s, *m;
/* Create the module and add the functions */
- Py_InitModule3("_dotblas", dotblas_module_methods, module_doc);
+#if defined(NPY_PY3K)
+ m = PyModule_Create(&moduledef);
+#else
+ m = Py_InitModule3("_dotblas", dotblas_module_methods, module_doc);
+#endif
/* Import the array object */
import_array();
@@ -1195,4 +1221,5 @@ PyMODINIT_FUNC init_dotblas(void) {
Py_DECREF(d);
Py_DECREF(s);
+ return RETVAL;
}