[Numpy-svn] r6301 - trunk/numpy/f2py

numpy-svn at scipy.org numpy-svn at scipy.org
Thu Jan 8 04:19:09 EST 2009


Author: cdavid
Date: 2009-01-08 03:19:00 -0600 (Thu, 08 Jan 2009)
New Revision: 6301

Modified:
   trunk/numpy/f2py/cfuncs.py
Log:
Avoid putting things into stderr when errors occurs in f2py wrappers; put all the info in the python error string instead.

Modified: trunk/numpy/f2py/cfuncs.py
===================================================================
--- trunk/numpy/f2py/cfuncs.py	2009-01-07 22:34:51 UTC (rev 6300)
+++ trunk/numpy/f2py/cfuncs.py	2009-01-08 09:19:00 UTC (rev 6301)
@@ -472,15 +472,17 @@
 cppmacros['CHECKSTRING']="""\
 #define CHECKSTRING(check,tcheck,name,show,var)\\
 \tif (!(check)) {\\
-\t\tPyErr_SetString(#modulename#_error,\"(\"tcheck\") failed for \"name);\\
-\t\tfprintf(stderr,show\"\\n\",slen(var),var);\\
+\t\tchar errstring[256];\\
+\t\tsprintf(errstring, \"%s: \"show, \"(\"tcheck\") failed for \"name, slen(var), var);\\
+\t\tPyErr_SetString(#modulename#_error, errstring);\\
 \t\t/*goto capi_fail;*/\\
 \t} else """
 cppmacros['CHECKSCALAR']="""\
 #define CHECKSCALAR(check,tcheck,name,show,var)\\
 \tif (!(check)) {\\
-\t\tPyErr_SetString(#modulename#_error,\"(\"tcheck\") failed for \"name);\\
-\t\tfprintf(stderr,show\"\\n\",var);\\
+\t\tchar errstring[256];\\
+\t\tsprintf(errstring, \"%s: \"show, \"(\"tcheck\") failed for \"name, var);\\
+\t\tPyErr_SetString(#modulename#_error,errstring);\\
 \t\t/*goto capi_fail;*/\\
 \t} else """
 ## cppmacros['CHECKDIMS']="""\




More information about the Numpy-svn mailing list