[Numpy-svn] r8283 - trunk/numpy/core/code_generators

numpy-svn@scip... numpy-svn@scip...
Sat Mar 6 17:58:28 CST 2010


Author: ptvirtan
Date: 2010-03-06 17:58:28 -0600 (Sat, 06 Mar 2010)
New Revision: 8283

Modified:
   trunk/numpy/core/code_generators/generate_numpy_api.py
Log:
3K: core: fix import_array to return NULL on failure -- according to the Py3 module init function scheme

Modified: trunk/numpy/core/code_generators/generate_numpy_api.py
===================================================================
--- trunk/numpy/core/code_generators/generate_numpy_api.py	2010-03-06 23:58:12 UTC (rev 8282)
+++ trunk/numpy/core/code_generators/generate_numpy_api.py	2010-03-06 23:58:28 UTC (rev 8283)
@@ -128,8 +128,14 @@
   return 0;
 }
 
-#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return; } }
+#if PY_VERSION_HEX >= 0x03000000
+#define NUMPY_IMPORT_ARRAY_RETVAL NULL
+#else
+#define NUMPY_IMPORT_ARRAY_RETVAL
+#endif
 
+#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
+
 #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; } }



More information about the Numpy-svn mailing list