[Scipy-svn] r6719 - trunk/scipy/signal

scipy-svn@scip... scipy-svn@scip...
Sat Sep 11 19:49:54 CDT 2010


Author: ptvirtan
Date: 2010-09-11 19:49:54 -0500 (Sat, 11 Sep 2010)
New Revision: 6719

Modified:
   trunk/scipy/signal/lfilter.c.src
   trunk/scipy/signal/sigtools.h
   trunk/scipy/signal/sigtoolsmodule.c
   trunk/scipy/signal/splinemodule.c
Log:
3K: signal now builds and passes most tests.

Modified: trunk/scipy/signal/lfilter.c.src
===================================================================
--- trunk/scipy/signal/lfilter.c.src	2010-09-12 00:49:39 UTC (rev 6718)
+++ trunk/scipy/signal/lfilter.c.src	2010-09-12 00:49:54 UTC (rev 6719)
@@ -7,6 +7,10 @@
 #define NO_IMPORT_ARRAY
 #include <numpy/noprefix.h>
 
+#if PY_VERSION_HEX >= 0x03000000
+#define PyNumber_Divide PyNumber_TrueDivide
+#endif
+
 #include "sigtools.h"
 
 static void FLOAT_filt(char *b, char *a, char *x, char *y, char *Z,

Modified: trunk/scipy/signal/sigtools.h
===================================================================
--- trunk/scipy/signal/sigtools.h	2010-09-12 00:49:39 UTC (rev 6718)
+++ trunk/scipy/signal/sigtools.h	2010-09-12 00:49:54 UTC (rev 6719)
@@ -2,6 +2,12 @@
 #define _SCIPY_PRIVATE_SIGNAL_SIGTOOLS_H_
 
 #include "Python.h"
+
+#if PY_VERSION_HEX >= 0x03000000
+    #define PyString_AsString PyBytes_AsString
+    #define PyString_FromFormat PyBytes_FromFormat
+#endif
+
 #include "numpy/noprefix.h"
 
 #define BOUNDARY_MASK 12

Modified: trunk/scipy/signal/sigtoolsmodule.c
===================================================================
--- trunk/scipy/signal/sigtoolsmodule.c	2010-09-12 00:49:39 UTC (rev 6718)
+++ trunk/scipy/signal/sigtoolsmodule.c	2010-09-12 00:49:54 UTC (rev 6719)
@@ -5,6 +5,7 @@
 is granted under the SciPy License.
 */
 #include <Python.h>
+
 #define PY_ARRAY_UNIQUE_SYMBOL _scipy_signal_ARRAY_API
 #include <numpy/noprefix.h>
 
@@ -822,10 +823,11 @@
 
 
 int OBJECT_compare(PyObject **ip1, PyObject **ip2) {
-        return PyObject_Compare(*ip1, *ip2);
+        /*return PyObject_Compare(*ip1, *ip2); */
+        return PyObject_RichCompareBool(*ip1, *ip2, Py_EQ) != 1;
 }
 
-typedef int (*CompareFunction) Py_FPROTO((const void *, const void *));
+typedef int (*CompareFunction)(const void *, const void *);
 
 CompareFunction compare_functions[] = \
 	{NULL, (CompareFunction)BYTE_compare,(CompareFunction)UBYTE_compare,\
@@ -1312,6 +1314,30 @@
 	{NULL, NULL, 0, NULL}		/* sentinel */
 };
 
+#if PY_VERSION_HEX >= 0x03000000
+static struct PyModuleDef moduledef = {
+    PyModuleDef_HEAD_INIT,
+    "sigtools",
+    NULL,
+    -1,
+    toolbox_module_methods,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
+PyObject *PyInit_sigtools(void)
+{
+    PyObject *m, *d, *s;
+
+    m = PyModule_Create(&moduledef);
+	import_array();
+
+    scipy_signal_sigtools_linear_filter_module_init();
+
+    return m;
+}
+#else
 /* Initialization function for the module (*must* be called initsigtools) */
 
 PyMODINIT_FUNC initsigtools(void) {
@@ -1346,3 +1372,4 @@
 	  Py_FatalError("can't initialize module array");
 	}
 }
+#endif

Modified: trunk/scipy/signal/splinemodule.c
===================================================================
--- trunk/scipy/signal/splinemodule.c	2010-09-12 00:49:39 UTC (rev 6718)
+++ trunk/scipy/signal/splinemodule.c	2010-09-12 00:49:54 UTC (rev 6719)
@@ -469,7 +469,40 @@
 };
 
 /* Initialization function for the module (*must* be called initXXXXX) */
+#if PY_VERSION_HEX >= 0x03000000
+static struct PyModuleDef moduledef = {
+    PyModuleDef_HEAD_INIT,
+    "spline",
+    NULL,
+    -1,
+    toolbox_module_methods,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
 
+PyObject *PyInit_spline(void)
+{
+    PyObject *m, *d, *s;
+
+    m = PyModule_Create(&moduledef);
+    import_array();
+
+    /* Add some symbolic constants to the module */
+    d = PyModule_GetDict(m);
+
+    s = PyUnicode_FromString("0.2");
+    PyDict_SetItemString(d, "__version__", s);
+    Py_DECREF(s);
+    
+    /* Check for errors */
+    if (PyErr_Occurred()) {
+        Py_FatalError("can't initialize module array");
+    }
+    return m;
+}
+#else
 PyMODINIT_FUNC initspline(void) {
     PyObject *m, *d, *s;
 	
@@ -490,18 +523,4 @@
     if (PyErr_Occurred())
 	Py_FatalError("can't initialize module array");
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+#endif



More information about the Scipy-svn mailing list