Skip to content

Commit e0f1cc1

Browse files
ganesh-k13charris
authored andcommitted
BUG: Added missing error check in ndarray.__contains__ (numpygh-15553)
Addes missing check for NULL return. resolves numpy#15552 resolves pandas-dev/pandas#31922
1 parent 50c93b8 commit e0f1cc1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

numpy/core/src/multiarray/sequence.c

+5
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@ array_contains(PyArrayObject *self, PyObject *el)
3838
if (res == NULL) {
3939
return -1;
4040
}
41+
4142
any = PyArray_Any((PyArrayObject *)res, NPY_MAXDIMS, NULL);
4243
Py_DECREF(res);
44+
if (any == NULL) {
45+
return -1;
46+
}
47+
4348
ret = PyObject_IsTrue(any);
4449
Py_DECREF(any);
4550
return ret;

0 commit comments

Comments
 (0)