[Numpy-svn] r3071 - in trunk/numpy/core: code_generators include/numpy

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Aug 25 16:33:46 CDT 2006


Author: oliphant
Date: 2006-08-25 16:33:42 -0500 (Fri, 25 Aug 2006)
New Revision: 3071

Modified:
   trunk/numpy/core/code_generators/generate_array_api.py
   trunk/numpy/core/code_generators/generate_ufunc_api.py
   trunk/numpy/core/include/numpy/oldnumeric.h
Log:
Add more import_array possibilities so it can be used inside a function.

Modified: trunk/numpy/core/code_generators/generate_array_api.py
===================================================================
--- trunk/numpy/core/code_generators/generate_array_api.py	2006-08-25 20:52:39 UTC (rev 3070)
+++ trunk/numpy/core/code_generators/generate_array_api.py	2006-08-25 21:33:42 UTC (rev 3071)
@@ -89,10 +89,8 @@
   return 0;
 }
 
-#define import_array() { if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); } }
+#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return; } }
 
-#define import_array0() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return ; } }
-
 #define import_array1(ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return ret; } }
 
 #define import_array2(msg, ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, msg); return ret; } }

Modified: trunk/numpy/core/code_generators/generate_ufunc_api.py
===================================================================
--- trunk/numpy/core/code_generators/generate_ufunc_api.py	2006-08-25 20:52:39 UTC (rev 3070)
+++ trunk/numpy/core/code_generators/generate_ufunc_api.py	2006-08-25 21:33:42 UTC (rev 3071)
@@ -48,10 +48,15 @@
   return 0;
 }
 
-#define import_umath() { if (_import_umath() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.umath failed to import\n"); return; }}
+#define import_umath() { if (_import_umath() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.umath failed to import"); return; }}
 
-#define import_ufunc import_umath
+#define import_umath1(ret) { if (_import_umath() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.umath failed to import"); return ret; }}
 
+#define import_umath2(msg, ret) { if (_import_umath() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, msg); return ret; }}
+
+#define import_ufunc() { if (_import_umath() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.umath failed to import"); }}
+
+
 #endif
 """
 

Modified: trunk/numpy/core/include/numpy/oldnumeric.h
===================================================================
--- trunk/numpy/core/include/numpy/oldnumeric.h	2006-08-25 20:52:39 UTC (rev 3070)
+++ trunk/numpy/core/include/numpy/oldnumeric.h	2006-08-25 21:33:42 UTC (rev 3071)
@@ -16,3 +16,7 @@
 #define OWN_DATA NPY_OWNDATA
 #define SAVESPACE 0
 #define SAVESPACEBIT 0
+
+#undef import_array()
+#define import_array() { if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); } }
+



More information about the Numpy-svn mailing list