Commit f202df6d authored by Damien George's avatar Damien George

py/objarray: Raise NotImplementedError for array equality of diff types.

It's too much work to implement proper array equality (per CPython
semantics) so just raise an exception if the case is not supported.
parent a814daa7
......@@ -301,6 +301,9 @@ STATIC mp_obj_t array_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs
if (!mp_get_buffer(rhs_in, &rhs_bufinfo, MP_BUFFER_READ)) {
return mp_const_false;
}
if (!MP_OBJ_IS_TYPE(rhs_in, &mp_type_array) || lhs_bufinfo.typecode != rhs_bufinfo.typecode) {
mp_raise_NotImplementedError("array equality with different types");
}
return mp_obj_new_bool(mp_seq_cmp_bytes(op, lhs_bufinfo.buf, lhs_bufinfo.len, rhs_bufinfo.buf, rhs_bufinfo.len));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment