diff options
author | Damien George <damien@micropython.org> | 2021-07-14 22:56:52 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-07-15 00:12:41 +1000 |
commit | 38a204ed9605a9233a66c86538562fab821ce63a (patch) | |
tree | 70786960922fad8c89ccf1e3e914ca88cf75a030 /extmod/modure.c | |
parent | bb00125aaac8376b8cc4c8f3da2423fcf6dae496 (diff) |
py: Introduce and use mp_raise_type_arg helper.
To reduce code size.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/modure.c')
-rw-r--r-- | extmod/modure.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/extmod/modure.c b/extmod/modure.c index d0829e8c5..738a2b984 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -68,7 +68,7 @@ STATIC mp_obj_t match_group(mp_obj_t self_in, mp_obj_t no_in) { mp_obj_match_t *self = MP_OBJ_TO_PTR(self_in); mp_int_t no = mp_obj_get_int(no_in); if (no < 0 || no >= self->num_matches) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, no_in)); + mp_raise_type_arg(&mp_type_IndexError, no_in); } const char *start = self->caps[no * 2]; @@ -107,7 +107,7 @@ STATIC void match_span_helper(size_t n_args, const mp_obj_t *args, mp_obj_t span if (n_args == 2) { no = mp_obj_get_int(args[1]); if (no < 0 || no >= self->num_matches) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, args[1])); + mp_raise_type_arg(&mp_type_IndexError, args[1]); } } @@ -334,7 +334,7 @@ STATIC mp_obj_t re_sub_helper(size_t n_args, const mp_obj_t *args) { } if (match_no >= (unsigned int)match->num_matches) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, MP_OBJ_NEW_SMALL_INT(match_no))); + mp_raise_type_arg(&mp_type_IndexError, MP_OBJ_NEW_SMALL_INT(match_no)); } const char *start_match = match->caps[match_no * 2]; |