all: Use MP_ERROR_TEXT for all error messages.

This commit is contained in:
Jim Mussared
2020-03-02 22:35:22 +11:00
committed by Damien George
parent 85858e72df
commit def76fe4d9
192 changed files with 823 additions and 919 deletions

View File

@@ -129,7 +129,7 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
if (mp_obj_is_small_int(index)) {
i = MP_OBJ_SMALL_INT_VALUE(index);
} else if (!mp_obj_get_int_maybe(index, &i)) {
mp_raise_msg_varg(&mp_type_TypeError, "string indices must be integers, not %s", mp_obj_get_type_str(index));
mp_raise_msg_varg(&mp_type_TypeError, MP_ERROR_TEXT("string indices must be integers, not %s"), mp_obj_get_type_str(index));
}
const byte *s, *top = self_data + self_len;
if (i < 0) {
@@ -139,7 +139,7 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
if (is_slice) {
return self_data;
}
mp_raise_msg(&mp_type_IndexError, "string index out of range");
mp_raise_msg(&mp_type_IndexError, MP_ERROR_TEXT("string index out of range"));
}
if (!UTF8_IS_CONT(*s)) {
++i;
@@ -158,7 +158,7 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
if (is_slice) {
return top;
}
mp_raise_msg(&mp_type_IndexError, "string index out of range");
mp_raise_msg(&mp_type_IndexError, MP_ERROR_TEXT("string index out of range"));
}
// Then check completion
if (i-- == 0) {
@@ -189,7 +189,7 @@ STATIC mp_obj_t str_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
ostep = slice->step;
if (ostep != mp_const_none && ostep != MP_OBJ_NEW_SMALL_INT(1)) {
mp_raise_NotImplementedError("only slices with step=1 (aka None) are supported");
mp_raise_NotImplementedError(MP_ERROR_TEXT("only slices with step=1 (aka None) are supported"));
}
const byte *pstart, *pstop;