summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever.FTA@gmail.com>2011-08-13 17:05:11 -0600
committerCharles Harris <charlesr.harris@gmail.com>2011-08-13 17:05:11 -0600
commit4dac50bf1faf2c8189c277ec8f11ead506c243b1 (patch)
tree822bd911618c48878902cb67dc070c5009a1ccda
parent51a096bcbc86d372c3568e721acc11c3c8e92676 (diff)
downloadpython-numpy-4dac50bf1faf2c8189c277ec8f11ead506c243b1.tar.gz
python-numpy-4dac50bf1faf2c8189c277ec8f11ead506c243b1.tar.bz2
python-numpy-4dac50bf1faf2c8189c277ec8f11ead506c243b1.zip
BUG: Fix import_umath macro to work with python 3.
-rw-r--r--numpy/core/code_generators/generate_ufunc_api.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/code_generators/generate_ufunc_api.py b/numpy/core/code_generators/generate_ufunc_api.py
index e6e50c2fe..da80226d9 100644
--- a/numpy/core/code_generators/generate_ufunc_api.py
+++ b/numpy/core/code_generators/generate_ufunc_api.py
@@ -75,7 +75,13 @@ _import_umath(void)
return 0;
}
-#define import_umath() { UFUNC_NOFPE if (_import_umath() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.umath failed to import"); return; }}
+#if PY_VERSION_HEX >= 0x03000000
+#define NUMPY_IMPORT_UMATH_RETVAL NULL
+#else
+#define NUMPY_IMPORT_UMATH_RETVAL
+#endif
+
+#define import_umath() { UFUNC_NOFPE if (_import_umath() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.umath failed to import"); return NUMPY_IMPORT_UMATH_RETVAL; }}
#define import_umath1(ret) { UFUNC_NOFPE if (_import_umath() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.umath failed to import"); return ret; }}