diff options
author | Damien George <damien.p.george@gmail.com> | 2015-05-12 23:05:53 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-05-12 23:05:53 +0100 |
commit | c50772d19fe2804a6d0258f89dd9967d3b516fd3 (patch) | |
tree | 9db781cc50f27fd4d07f9ef1db9a862a29690d53 /extmod/modure.c | |
parent | c2a4e4effc81d8ab21bb014e34355643e5ca0da2 (diff) |
py: Add mp_obj_get_int_truncated and use it where appropriate.
mp_obj_get_int_truncated will raise a TypeError if the argument is not
an integral type. Use mp_obj_int_get_truncated only when you know the
argument is a small or big int.
Diffstat (limited to 'extmod/modure.c')
-rw-r--r-- | extmod/modure.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/extmod/modure.c b/extmod/modure.c index 9bc72add2..f54b060c8 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -59,7 +59,7 @@ STATIC void match_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind STATIC mp_obj_t match_group(mp_obj_t self_in, mp_obj_t no_in) { mp_obj_match_t *self = self_in; - mp_int_t no = mp_obj_int_get_truncated(no_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)); } @@ -135,7 +135,7 @@ STATIC mp_obj_t re_split(uint n_args, const mp_obj_t *args) { int maxsplit = 0; if (n_args > 2) { - maxsplit = mp_obj_int_get_truncated(args[2]); + maxsplit = mp_obj_get_int(args[2]); } mp_obj_t retval = mp_obj_new_list(0, NULL); |