Bit confused here, are the calls to `PyObject_RichCompareBool` and ` PyArray_CanCastTypeTo` in the right order? Might also make sense to have `item1` and `item2` as variables in this block, it might clarify the code a bit.