diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-20 14:11:27 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-20 14:11:27 +0000 |
commit | 50149a573063dc4a1a6541686e61c310d5fc8353 (patch) | |
tree | ba09b7f32e24ee050d4888c7d1e588882d142770 /py/objmap.c | |
parent | ff8dd3f486afb0d6ff1427d8a6a8a8ed73baa660 (diff) | |
download | micropython-50149a573063dc4a1a6541686e61c310d5fc8353.tar.gz micropython-50149a573063dc4a1a6541686e61c310d5fc8353.zip |
py: Use mp_arg_check_num in some _make_new functions.
Reduces stmhal code size by about 250 bytes.
Diffstat (limited to 'py/objmap.c')
-rw-r--r-- | py/objmap.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/py/objmap.c b/py/objmap.c index 3225b4dc93..d9df9fdea3 100644 --- a/py/objmap.c +++ b/py/objmap.c @@ -27,7 +27,6 @@ #include <stdlib.h> #include <assert.h> -#include "py/nlr.h" #include "py/runtime.h" typedef struct _mp_obj_map_t { @@ -38,10 +37,7 @@ typedef struct _mp_obj_map_t { } mp_obj_map_t; STATIC mp_obj_t map_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) { - if (n_args < 2 || n_kw != 0) { - nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "map must have at least 2 arguments and no keyword arguments")); - } - assert(n_args >= 2); + mp_arg_check_num(n_args, n_kw, 2, MP_OBJ_FUN_ARGS_MAX, false); mp_obj_map_t *o = m_new_obj_var(mp_obj_map_t, mp_obj_t, n_args - 1); o->base.type = type_in; o->n_iters = n_args - 1; |