[Scipy-svn] r6807 - in trunk/scipy/lib: blas lapack

scipy-svn@scip... scipy-svn@scip...
Tue Sep 14 18:08:08 CDT 2010


Author: ptvirtan
Date: 2010-09-14 18:08:08 -0500 (Tue, 14 Sep 2010)
New Revision: 6807

Modified:
   trunk/scipy/lib/blas/atlas_version.c
   trunk/scipy/lib/lapack/atlas_version.c
Log:
BUG: lib: make atlas_version.c's Py3 compatible (fixes #1280)

Modified: trunk/scipy/lib/blas/atlas_version.c
===================================================================
--- trunk/scipy/lib/blas/atlas_version.c	2010-09-14 23:07:54 UTC (rev 6806)
+++ trunk/scipy/lib/blas/atlas_version.c	2010-09-14 23:08:08 UTC (rev 6807)
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "numpy/npy_3kcompat.h"
 
 static PyObject* version(PyObject* self, PyObject* dummy)
 {
@@ -20,14 +21,41 @@
     {NULL, NULL, 0, NULL}
 };
 
+#if PY_VERSION_HEX >= 0x03000000
+
+static struct PyModuleDef moduledef = {
+    PyModuleDef_HEAD_INIT,
+    "atlas_version",
+    NULL,
+    -1,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
+
+PyObject *PyInit_atlas_version(void)
+{
+#define RETVAL m
+    PyObject *m;
+    m = PyModule_Create(&moduledef);
+#else
+#define RETVAL
 PyMODINIT_FUNC initatlas_version(void)
 {
     PyObject *m = NULL;
     m = Py_InitModule("atlas_version", module_methods);
+#endif
+    if (m == NULL) {
+        return RETVAL;
+    }
 #if defined(ATLAS_INFO)
     {
         PyObject *d = PyModule_GetDict(m);
-        PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO));
+        PyDict_SetItemString(d,"ATLAS_VERSION",
+                             PyUString_FromString(ATLAS_INFO));
     }
 #endif
+    return RETVAL;
 }

Modified: trunk/scipy/lib/lapack/atlas_version.c
===================================================================
--- trunk/scipy/lib/lapack/atlas_version.c	2010-09-14 23:07:54 UTC (rev 6806)
+++ trunk/scipy/lib/lapack/atlas_version.c	2010-09-14 23:08:08 UTC (rev 6807)
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "numpy/npy_3kcompat.h"
 
 static PyObject* version(PyObject* self, PyObject* dummy)
 {
@@ -20,14 +21,41 @@
     {NULL, NULL, 0, NULL}
 };
 
+#if PY_VERSION_HEX >= 0x03000000
+
+static struct PyModuleDef moduledef = {
+    PyModuleDef_HEAD_INIT,
+    "atlas_version",
+    NULL,
+    -1,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
+
+PyObject *PyInit_atlas_version(void)
+{
+#define RETVAL m
+    PyObject *m;
+    m = PyModule_Create(&moduledef);
+#else
+#define RETVAL
 PyMODINIT_FUNC initatlas_version(void)
 {
     PyObject *m = NULL;
     m = Py_InitModule("atlas_version", module_methods);
+#endif
+    if (m == NULL) {
+        return RETVAL;
+    }
 #if defined(ATLAS_INFO)
     {
         PyObject *d = PyModule_GetDict(m);
-        PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO));
+        PyDict_SetItemString(d,"ATLAS_VERSION",
+                             PyUString_FromString(ATLAS_INFO));
     }
 #endif
+    return RETVAL;
 }



More information about the Scipy-svn mailing list