summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2009-12-10 20:04:01 +0000
committerPauli Virtanen <pav@iki.fi>2009-12-10 20:04:01 +0000
commit5053c6fa4e6b6d4ebba30905690ca6e9940db54f (patch)
tree79c278300f53e3361d763517f83054db4fcfe377
parent977e43600cbd7056b84d7ee802dc1402cb4b0bc5 (diff)
downloadnumpy-5053c6fa4e6b6d4ebba30905690ca6e9940db54f.tar.gz
BUG: use PyErr_Warn instead of WarnEx on Py2.4
-rw-r--r--numpy/core/src/multiarray/convert_datatype.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/convert_datatype.c b/numpy/core/src/multiarray/convert_datatype.c
index 93c0bc22a..6ffbfe397 100644
--- a/numpy/core/src/multiarray/convert_datatype.c
+++ b/numpy/core/src/multiarray/convert_datatype.c
@@ -117,9 +117,15 @@ PyArray_GetCastFunc(PyArray_Descr *descr, int type_num)
cls = PyObject_GetAttrString(obj, "ComplexWarning");
Py_DECREF(obj);
}
+#if PY_VERSION_HEX >= 0x02050000
PyErr_WarnEx(cls,
"Casting complex values to real discards the imaginary "
"part", 0);
+#else
+ PyErr_Warn(cls,
+ "Casting complex values to real discards the imaginary "
+ "part");
+#endif
Py_XDECREF(cls);
}
if (castfunc) {