summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/descriptor.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c
index f0dfac55d..3f06acd58 100644
--- a/numpy/core/src/multiarray/descriptor.c
+++ b/numpy/core/src/multiarray/descriptor.c
@@ -3228,7 +3228,22 @@ arraydescr_richcompare(PyArray_Descr *self, PyObject *other, int cmp_op)
{
PyArray_Descr *new = _convert_from_any(other, 0);
if (new == NULL) {
- return NULL;
+ /* Cannot convert `other` to dtype */
+
+ PyErr_Clear();
+
+ switch (cmp_op) {
+ case Py_LT:
+ case Py_LE:
+ case Py_EQ:
+ case Py_GT:
+ case Py_GE:
+ Py_RETURN_FALSE;
+ case Py_NE:
+ Py_RETURN_TRUE;
+ default:
+ Py_RETURN_NOTIMPLEMENTED;
+ }
}
npy_bool ret;