all: Raise exceptions via mp_raise_XXX
- Changed: ValueError, TypeError, NotImplementedError
- OSError invocations unchanged, because the corresponding utility
function takes ints, not strings like the long form invocation.
- OverflowError, IndexError and RuntimeError etc. not changed for now
until we decide whether to add new utility functions.
This commit is contained in:
@@ -288,7 +288,7 @@ STATIC mp_obj_t array_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in)
|
||||
|
||||
// Otherwise, can only look for a scalar numeric value in an array
|
||||
if (MP_OBJ_IS_INT(rhs_in) || mp_obj_is_float(rhs_in)) {
|
||||
mp_not_implemented("");
|
||||
mp_raise_NotImplementedError("");
|
||||
}
|
||||
|
||||
return mp_const_false;
|
||||
@@ -378,7 +378,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
|
||||
} else if (MP_OBJ_IS_TYPE(index_in, &mp_type_slice)) {
|
||||
mp_bound_slice_t slice;
|
||||
if (!mp_seq_get_fast_slice_indexes(o->len, index_in, &slice)) {
|
||||
mp_not_implemented("only slices with step=1 (aka None) are supported");
|
||||
mp_raise_NotImplementedError("only slices with step=1 (aka None) are supported");
|
||||
}
|
||||
if (value != MP_OBJ_SENTINEL) {
|
||||
#if MICROPY_PY_ARRAY_SLICE_ASSIGN
|
||||
@@ -409,7 +409,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
|
||||
src_len = bufinfo.len;
|
||||
src_items = bufinfo.buf;
|
||||
} else {
|
||||
mp_not_implemented("array/bytes required on right side");
|
||||
mp_raise_NotImplementedError("array/bytes required on right side");
|
||||
}
|
||||
|
||||
// TODO: check src/dst compat
|
||||
|
||||
Reference in New Issue
Block a user