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

scipy-svn@scip... scipy-svn@scip...
Thu Jan 28 20:20:06 CST 2010


Author: cdavid
Date: 2010-01-28 20:20:05 -0600 (Thu, 28 Jan 2010)
New Revision: 6211

Modified:
   trunk/scipy/signal/lfilter.c.src
Log:
ENH: improve error message for unsupported dtype in lfilter.

Modified: trunk/scipy/signal/lfilter.c.src
===================================================================
--- trunk/scipy/signal/lfilter.c.src	2010-01-22 14:22:25 UTC (rev 6210)
+++ trunk/scipy/signal/lfilter.c.src	2010-01-29 02:20:05 UTC (rev 6211)
@@ -116,8 +116,22 @@
 
     basic_filter = BasicFilterFunctions[(int) (arX->descr->type_num)];
     if (basic_filter == NULL) {
-        PyErr_SetString(PyExc_ValueError,
-                        "linear_filter not available for this type");
+        PyObject *msg, *str;
+        char *s;
+
+        str = PyObject_Str((PyObject*)arX->descr);
+        if (str == NULL) {
+            goto fail;
+        }
+        s = PyString_AsString(str);
+        msg = PyString_FromFormat(
+                        "input type '%s' not supported\n", s);
+        Py_DECREF(str);
+        if (msg == NULL) {
+            goto fail;
+        }
+        PyErr_SetObject(PyExc_NotImplementedError, msg);
+        Py_DECREF(msg);
         goto fail;
     }
 



More information about the Scipy-svn mailing list