Skip to content

Commit 821b7f2

Browse files
committed
py: Use mp_not_implemented consistently for not implemented features.
1 parent 25afc7d commit 821b7f2

5 files changed

Lines changed: 6 additions & 11 deletions

File tree

py/argcheck.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ NORETURN void mp_arg_error_terse_mismatch(void) {
146146

147147
#if MICROPY_CPYTHON_COMPAT
148148
NORETURN void mp_arg_error_unimpl_kw(void) {
149-
nlr_raise(mp_obj_new_exception_msg(&mp_type_NotImplementedError,
150-
"keyword argument(s) not yet implemented - use normal args instead"));
149+
mp_not_implemented("keyword argument(s) not yet implemented - use normal args instead");
151150
}
152151
#endif

py/objarray.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
365365
} else if (MP_OBJ_IS_TYPE(index_in, &mp_type_slice)) {
366366
mp_bound_slice_t slice;
367367
if (!mp_seq_get_fast_slice_indexes(o->len, index_in, &slice)) {
368-
nlr_raise(mp_obj_new_exception_msg(&mp_type_NotImplementedError,
369-
"only slices with step=1 (aka None) are supported"));
368+
mp_not_implemented("only slices with step=1 (aka None) are supported");
370369
}
371370
if (value != MP_OBJ_SENTINEL) {
372371
#if MICROPY_PY_ARRAY_SLICE_ASSIGN

py/objstr.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,7 @@ STATIC mp_obj_t bytes_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
391391
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
392392
mp_bound_slice_t slice;
393393
if (!mp_seq_get_fast_slice_indexes(self_len, index, &slice)) {
394-
nlr_raise(mp_obj_new_exception_msg(&mp_type_NotImplementedError,
395-
"only slices with step=1 (aka None) are supported"));
394+
mp_not_implemented("only slices with step=1 (aka None) are supported");
396395
}
397396
return mp_obj_new_str_of_type(type, self_data + slice.start, slice.stop - slice.start);
398397
}
@@ -975,7 +974,7 @@ mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwa
975974
arg = key_elem->value;
976975
}
977976
if (*lookup) {
978-
nlr_raise(mp_obj_new_exception_msg(&mp_type_NotImplementedError, "attributes not supported yet"));
977+
mp_not_implemented("attributes not supported yet");
979978
}
980979
vstr_free(field_name);
981980
field_name = NULL;

py/objstrunicode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ STATIC mp_obj_t str_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
178178
mp_obj_t ostart, ostop, ostep;
179179
mp_obj_slice_get(index, &ostart, &ostop, &ostep);
180180
if (ostep != mp_const_none && ostep != MP_OBJ_NEW_SMALL_INT(1)) {
181-
nlr_raise(mp_obj_new_exception_msg(&mp_type_NotImplementedError,
182-
"only slices with step=1 (aka None) are supported"));
181+
mp_not_implemented("only slices with step=1 (aka None) are supported");
183182
}
184183

185184
const byte *pstart, *pstop;

py/objtuple.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ mp_obj_t mp_obj_tuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
183183
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
184184
mp_bound_slice_t slice;
185185
if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice)) {
186-
nlr_raise(mp_obj_new_exception_msg(&mp_type_NotImplementedError,
187-
"only slices with step=1 (aka None) are supported"));
186+
mp_not_implemented("only slices with step=1 (aka None) are supported");
188187
}
189188
mp_obj_tuple_t *res = mp_obj_new_tuple(slice.stop - slice.start, NULL);
190189
mp_seq_copy(res->items, self->items + slice.start, res->len, mp_obj_t);

0 commit comments

Comments
 (0)