[Numpy-svn] r8600 - branches/1.5.x/numpy/core/blasdot

numpy-svn@scip... numpy-svn@scip...
Wed Aug 4 14:54:58 CDT 2010


Author: ptvirtan
Date: 2010-08-04 14:54:58 -0500 (Wed, 04 Aug 2010)
New Revision: 8600

Modified:
   branches/1.5.x/numpy/core/blasdot/_dotblas.c
Log:
3K: (backport r8599) fix core/dotblas module initialization.

Modified: branches/1.5.x/numpy/core/blasdot/_dotblas.c
===================================================================
--- branches/1.5.x/numpy/core/blasdot/_dotblas.c	2010-08-04 19:40:55 UTC (rev 8599)
+++ branches/1.5.x/numpy/core/blasdot/_dotblas.c	2010-08-04 19:54:58 UTC (rev 8600)
@@ -2,6 +2,7 @@
 "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 @@
     {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 @@
     Py_DECREF(d);
     Py_DECREF(s);
 
+    return RETVAL;
 }



More information about the Numpy-svn mailing list