[Numpy-svn] r3044 - in trunk/numpy: core/code_generators core/src f2py lib numarray/numpy

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Aug 21 14:55:43 CDT 2006


Author: oliphant
Date: 2006-08-21 14:55:37 -0500 (Mon, 21 Aug 2006)
New Revision: 3044

Modified:
   trunk/numpy/core/code_generators/generate_array_api.py
   trunk/numpy/core/code_generators/generate_ufunc_api.py
   trunk/numpy/core/src/ufuncobject.c
   trunk/numpy/f2py/rules.py
   trunk/numpy/lib/function_base.py
   trunk/numpy/numarray/numpy/libnumarray.h
Log:
Remove usage of FatalError and fix linspace to end at stop if endpoint is True

Modified: trunk/numpy/core/code_generators/generate_array_api.py
===================================================================
--- trunk/numpy/core/code_generators/generate_array_api.py	2006-08-21 19:04:25 UTC (rev 3043)
+++ trunk/numpy/core/code_generators/generate_array_api.py	2006-08-21 19:55:37 UTC (rev 3044)
@@ -88,7 +88,7 @@
   return 0;
 }
 
-#define import_array() { if (_import_array() < 0) {PyErr_Print(); Py_FatalError("numpy.core.multiarray failed to import... exiting.\n"); } }
+#define import_array() { if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return; } }
 
 #endif
 

Modified: trunk/numpy/core/code_generators/generate_ufunc_api.py
===================================================================
--- trunk/numpy/core/code_generators/generate_ufunc_api.py	2006-08-21 19:04:25 UTC (rev 3043)
+++ trunk/numpy/core/code_generators/generate_ufunc_api.py	2006-08-21 19:55:37 UTC (rev 3044)
@@ -48,7 +48,7 @@
   return 0;
 }
 
-#define import_umath() { if (_import_umath() < 0) {PyErr_Print(); Py_FatalError("numpy.core.umath failed to import... exiting.\n"); }}
+#define import_umath() { if (_import_umath() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.umath failed to import\n"); return; }}
 
 #define import_ufunc import_umath
 

Modified: trunk/numpy/core/src/ufuncobject.c
===================================================================
--- trunk/numpy/core/src/ufuncobject.c	2006-08-21 19:04:25 UTC (rev 3043)
+++ trunk/numpy/core/src/ufuncobject.c	2006-08-21 19:55:37 UTC (rev 3044)
@@ -3025,7 +3025,7 @@
 /*UFUNC_API*/
 static int
 PyUFunc_ReplaceLoopBySignature(PyUFuncObject *func, 
-			       PyUFuncGenericFunction *newfunc, 
+			       PyUFuncGenericFunction newfunc, 
 			       int *signature, 
 			       PyUFuncGenericFunction *oldfunc)
 {
@@ -3033,7 +3033,7 @@
 	/* Find the location of the matching signature */
 	for (i=0; i<func->ntypes; i++) {
 		for (j=0; j<func->nargs; j++) {
-			if (signature[j] == func->types[i*self->nargs+j])
+			if (signature[j] == func->types[i*func->nargs+j])
 				break;
 		}
 		if (j >= func->nargs) return -1;

Modified: trunk/numpy/f2py/rules.py
===================================================================
--- trunk/numpy/f2py/rules.py	2006-08-21 19:04:25 UTC (rev 3043)
+++ trunk/numpy/f2py/rules.py	2006-08-21 19:55:37 UTC (rev 3044)
@@ -173,8 +173,8 @@
 \tm = #modulename#_module = Py_InitModule(\"#modulename#\", f2py_module_methods);
 \tPyFortran_Type.ob_type = &PyType_Type;
 \timport_array();
-\tif (PyErr_Occurred())
-\t\tPy_FatalError(\"can't initialize module #modulename# (failed to import numpy)\");
+\tif (PyErr_Occurred()) 
+\t\t{PyErr_SetString(PyExc_ImportError, \"can't initialize module #modulename# (failed to import numpy)\"); return;}
 \td = PyModule_GetDict(m);
 \ts = PyString_FromString(\"$R"""+"""evision: $\");
 \tPyDict_SetItemString(d, \"__version__\", s);

Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py	2006-08-21 19:04:25 UTC (rev 3043)
+++ trunk/numpy/lib/function_base.py	2006-08-21 19:55:37 UTC (rev 3044)
@@ -42,6 +42,8 @@
     else:
         step = (stop-start)/float(num)
     y = _nx.arange(0, num) * step + start
+    if endpoint:
+        y[-1] = stop
     if retstep:
         return y, step
     else:

Modified: trunk/numpy/numarray/numpy/libnumarray.h
===================================================================
--- trunk/numpy/numarray/numpy/libnumarray.h	2006-08-21 19:04:25 UTC (rev 3043)
+++ trunk/numpy/numarray/numpy/libnumarray.h	2006-08-21 19:55:37 UTC (rev 3044)
@@ -56,7 +56,7 @@
         }                                                                   \
       }
       
-#define import_libnumarray() _import_libnumarray(); if (PyErr_Occurred()) { PyErr_Print(); Py_FatalError("numpy.numarray._capi failed to import... exiting.\n"); }
+#define import_libnumarray() _import_libnumarray(); if (PyErr_Occurred()) { PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.numarray._capi failed to import.\n"); return; }
       
 #endif
 



More information about the Numpy-svn mailing list