aboutsummaryrefslogtreecommitdiff
path: root/py/objstr.c
diff options
context:
space:
mode:
authorJavier Candeira <javier@candeira.com>2017-08-09 14:40:45 +1000
committerJavier Candeira <javier@candeira.com>2017-08-13 22:52:33 +1000
commit35a1fea90b2cae9d5cc8e9eab62ba4c67e8786db (patch)
tree26616de189a9154309287846bf76fb1cdab8ce51 /py/objstr.c
parentb6a328956467339f568b19d9192fbbfdfa47a572 (diff)
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.
Diffstat (limited to 'py/objstr.c')
-rw-r--r--py/objstr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/py/objstr.c b/py/objstr.c
index cc3dda59e..d4c038a68 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -404,7 +404,7 @@ STATIC mp_obj_t bytes_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
mp_bound_slice_t slice;
if (!mp_seq_get_fast_slice_indexes(self_len, index, &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");
}
return mp_obj_new_str_of_type(type, self_data + slice.start, slice.stop - slice.start);
}
@@ -618,7 +618,7 @@ STATIC mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args) {
mp_int_t idx = splits;
if (sep == mp_const_none) {
- mp_not_implemented("rsplit(None,n)");
+ mp_raise_NotImplementedError("rsplit(None,n)");
} else {
size_t sep_len;
const char *sep_str = mp_obj_str_get_data(sep, &sep_len);
@@ -742,7 +742,7 @@ STATIC mp_obj_t str_endswith(size_t n_args, const mp_obj_t *args) {
GET_STR_DATA_LEN(args[0], str, str_len);
GET_STR_DATA_LEN(args[1], suffix, suffix_len);
if (n_args > 2) {
- mp_not_implemented("start/end indices");
+ mp_raise_NotImplementedError("start/end indices");
}
if (suffix_len > str_len) {
@@ -1044,7 +1044,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
arg = key_elem->value;
}
if (field_name < field_name_top) {
- mp_not_implemented("attributes not supported yet");
+ mp_raise_NotImplementedError("attributes not supported yet");
}
} else {
if (*arg_i < 0) {