diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-08-04 11:27:36 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-08-04 14:45:45 -0500 |
| commit | c849b781c0186d93a1165784ce4e22d2178d5ccb (patch) | |
| tree | 650b9259a33d12a64e3f826267da3aa4968b1b84 /py | |
| parent | 89797fd3f9d36cd7e2e7a125dbbe02f598874060 (diff) | |
Combine 'index out of range' messages
Diffstat (limited to 'py')
| -rw-r--r-- | py/objstr.c | 4 | ||||
| -rw-r--r-- | py/objstrunicode.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/py/objstr.c b/py/objstr.c index 572bf299d..edb562df2 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -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); 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_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) { - 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_i)++; diff --git a/py/objstrunicode.c b/py/objstrunicode.c index 19d89a31c..50250abfa 100644 --- a/py/objstrunicode.c +++ b/py/objstrunicode.c @@ -162,7 +162,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_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)) { ++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) { 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 if (i-- == 0) { |
