summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wiebe <mwwiebe@gmail.com>2010-12-02 11:13:19 -0800
committerMark Wiebe <mwwiebe@gmail.com>2010-12-02 11:13:19 -0800
commitc0e1c0000f27b55dfd5aa4b1674a8c1b6ac38c36 (patch)
tree38a5a55e826c35def5636fec6575cad0e2bd0bae
parent8d0b5817a3fd4f3ce465aba2fd0ddd30677b8e60 (diff)
downloadnumpy-c0e1c0000f27b55dfd5aa4b1674a8c1b6ac38c36.tar.gz
BUG: core: The array_richcompare result, temp, may be a scalar so need to check
This was causing a segfault on some platforms.
-rw-r--r--numpy/core/src/multiarray/arrayobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c
index 0b59c6b59..03760d3fa 100644
--- a/numpy/core/src/multiarray/arrayobject.c
+++ b/numpy/core/src/multiarray/arrayobject.c
@@ -859,7 +859,7 @@ _void_compare(PyArrayObject *self, PyArrayObject *other, int cmp_op)
* dimensions will have been appended to `a` and `b`.
* In that case, reduce them using `op`.
*/
- if (PyArray_NDIM(temp) > result_ndim) {
+ if (PyArray_Check(temp) && PyArray_NDIM(temp) > result_ndim) {
/* If the type was multidimensional, collapse that part to 1-D
*/
if (PyArray_NDIM(temp) != result_ndim+1) {