| 3401 | } |
| 3402 | |
| 3403 | static PyObject * |
| 3404 | arraydescr_richcompare(PyArray_Descr *self, PyObject *other, int cmp_op) |
| 3405 | { |
| 3406 | PyArray_Descr *new = _convert_from_any(other, 0); |
| 3407 | if (new == NULL) { |
| 3408 | /* Cannot convert `other` to dtype */ |
| 3409 | PyErr_Clear(); |
| 3410 | Py_RETURN_NOTIMPLEMENTED; |
| 3411 | } |
| 3412 | |
| 3413 | npy_bool ret; |
| 3414 | switch (cmp_op) { |
| 3415 | case Py_LT: |
| 3416 | ret = !PyArray_EquivTypes(self, new) && PyArray_CanCastTo(self, new); |
| 3417 | Py_DECREF(new); |
| 3418 | return PyBool_FromLong(ret); |
| 3419 | case Py_LE: |
| 3420 | ret = PyArray_CanCastTo(self, new); |
| 3421 | Py_DECREF(new); |
| 3422 | return PyBool_FromLong(ret); |
| 3423 | case Py_EQ: |
| 3424 | ret = PyArray_EquivTypes(self, new); |
| 3425 | Py_DECREF(new); |
| 3426 | return PyBool_FromLong(ret); |
| 3427 | case Py_NE: |
| 3428 | ret = !PyArray_EquivTypes(self, new); |
| 3429 | Py_DECREF(new); |
| 3430 | return PyBool_FromLong(ret); |
| 3431 | case Py_GT: |
| 3432 | ret = !PyArray_EquivTypes(self, new) && PyArray_CanCastTo(new, self); |
| 3433 | Py_DECREF(new); |
| 3434 | return PyBool_FromLong(ret); |
| 3435 | case Py_GE: |
| 3436 | ret = PyArray_CanCastTo(new, self); |
| 3437 | Py_DECREF(new); |
| 3438 | return PyBool_FromLong(ret); |
| 3439 | default: |
| 3440 | Py_DECREF(new); |
| 3441 | Py_RETURN_NOTIMPLEMENTED; |
| 3442 | } |
| 3443 | } |
| 3444 | |
| 3445 | static int |
| 3446 | descr_nonzero(PyObject *NPY_UNUSED(self)) |
nothing calls this directly
no test coverage detected