Combine 'index out of range' messages
This commit is contained in:
parent
89797fd3f9
commit
c849b781c0
@ -520,7 +520,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
|
|||||||
uint val_type = GET_TYPE(arr_sz, VAL_TYPE_BITS);
|
uint val_type = GET_TYPE(arr_sz, VAL_TYPE_BITS);
|
||||||
arr_sz &= VALUE_MASK(VAL_TYPE_BITS);
|
arr_sz &= VALUE_MASK(VAL_TYPE_BITS);
|
||||||
if (index >= arr_sz) {
|
if (index >= arr_sz) {
|
||||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_IndexError, translate("struct: index out of range")));
|
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_struct);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t->len == 2) {
|
if (t->len == 2) {
|
||||||
|
@ -330,7 +330,7 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self,
|
|||||||
}
|
}
|
||||||
if (index < 0 || index >= self->len) {
|
if (index < 0 || index >= self->len) {
|
||||||
common_hal_mcu_enable_interrupts();
|
common_hal_mcu_enable_interrupts();
|
||||||
mp_raise_IndexError(translate("index out of range"));
|
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_PulseIn);
|
||||||
}
|
}
|
||||||
uint16_t value = self->buffer[(self->start + index) % self->maxlen];
|
uint16_t value = self->buffer[(self->start + index) % self->maxlen];
|
||||||
common_hal_mcu_enable_interrupts();
|
common_hal_mcu_enable_interrupts();
|
||||||
|
@ -190,7 +190,7 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, int16_
|
|||||||
}
|
}
|
||||||
if (index < 0 || index >= self->len) {
|
if (index < 0 || index >= self->len) {
|
||||||
common_hal_mcu_enable_interrupts();
|
common_hal_mcu_enable_interrupts();
|
||||||
mp_raise_IndexError(translate("index out of range"));
|
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_PulseIn);
|
||||||
}
|
}
|
||||||
uint16_t value = self->buffer[(self->start + index) % self->maxlen];
|
uint16_t value = self->buffer[(self->start + index) % self->maxlen];
|
||||||
common_hal_mcu_enable_interrupts();
|
common_hal_mcu_enable_interrupts();
|
||||||
|
@ -237,7 +237,7 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self,
|
|||||||
// }
|
// }
|
||||||
// if (index < 0 || index >= self->len) {
|
// if (index < 0 || index >= self->len) {
|
||||||
// common_hal_mcu_enable_interrupts();
|
// common_hal_mcu_enable_interrupts();
|
||||||
// mp_raise_IndexError(translate("index out of range"));
|
// mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_PulseIn);
|
||||||
// }
|
// }
|
||||||
// uint16_t value = self->buffer[(self->start + index) % self->maxlen];
|
// uint16_t value = self->buffer[(self->start + index) % self->maxlen];
|
||||||
// common_hal_mcu_enable_interrupts();
|
// common_hal_mcu_enable_interrupts();
|
||||||
|
@ -271,7 +271,7 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_
|
|||||||
if ( !self->paused ) {
|
if ( !self->paused ) {
|
||||||
nrfx_gpiote_in_event_enable(self->pin, true);
|
nrfx_gpiote_in_event_enable(self->pin, true);
|
||||||
}
|
}
|
||||||
mp_raise_IndexError(translate("index out of range"));
|
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_PulseIn);
|
||||||
}
|
}
|
||||||
uint16_t value = self->buffer[(self->start + index) % self->maxlen];
|
uint16_t value = self->buffer[(self->start + index) % self->maxlen];
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_
|
|||||||
}
|
}
|
||||||
if (index < 0 || index >= self->len) {
|
if (index < 0 || index >= self->len) {
|
||||||
HAL_NVIC_EnableIRQ(self->irq);
|
HAL_NVIC_EnableIRQ(self->irq);
|
||||||
mp_raise_IndexError(translate("index out of range"));
|
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_PulseIn);
|
||||||
}
|
}
|
||||||
uint16_t value = self->buffer[(self->start + index) % self->maxlen];
|
uint16_t value = self->buffer[(self->start + index) % self->maxlen];
|
||||||
HAL_NVIC_EnableIRQ(self->irq);
|
HAL_NVIC_EnableIRQ(self->irq);
|
||||||
|
@ -1076,7 +1076,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
|
|||||||
}
|
}
|
||||||
field_name = str_to_int(field_name, field_name_top, &index);
|
field_name = str_to_int(field_name, field_name_top, &index);
|
||||||
if ((uint)index >= n_args - 1) {
|
if ((uint)index >= n_args - 1) {
|
||||||
mp_raise_IndexError(translate("tuple index out of range"));
|
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_tuple);
|
||||||
}
|
}
|
||||||
arg = args[index + 1];
|
arg = args[index + 1];
|
||||||
*arg_i = -1;
|
*arg_i = -1;
|
||||||
@ -1104,7 +1104,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((uint)*arg_i >= n_args - 1) {
|
if ((uint)*arg_i >= n_args - 1) {
|
||||||
mp_raise_IndexError(translate("tuple index out of range"));
|
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_tuple);
|
||||||
}
|
}
|
||||||
arg = args[(*arg_i) + 1];
|
arg = args[(*arg_i) + 1];
|
||||||
(*arg_i)++;
|
(*arg_i)++;
|
||||||
|
@ -162,7 +162,7 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
|
|||||||
if (is_slice) {
|
if (is_slice) {
|
||||||
return self_data;
|
return self_data;
|
||||||
}
|
}
|
||||||
mp_raise_IndexError(translate("string index out of range"));
|
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_str);
|
||||||
}
|
}
|
||||||
if (!UTF8_IS_CONT(*s)) {
|
if (!UTF8_IS_CONT(*s)) {
|
||||||
++i;
|
++i;
|
||||||
@ -181,7 +181,7 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
|
|||||||
if (is_slice) {
|
if (is_slice) {
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
mp_raise_IndexError(translate("string index out of range"));
|
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_str);
|
||||||
}
|
}
|
||||||
// Then check completion
|
// Then check completion
|
||||||
if (i-- == 0) {
|
if (i-- == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user