diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-20 00:13:22 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-20 00:13:22 +0100 |
commit | a3f94e0030dc209f4d180531878cede7a1e2dbbe (patch) | |
tree | 3a37a5ea97763c8e6df9431401ed2345bdca14eb /py/objarray.c | |
parent | 27dd471098e5d27949826295e821df972d9af083 (diff) | |
download | micropython-a3f94e0030dc209f4d180531878cede7a1e2dbbe.tar.gz micropython-a3f94e0030dc209f4d180531878cede7a1e2dbbe.zip |
py: Add arg checking helper functions.
These are to assist in writing native C functions that take positional
and keyword arguments. mp_arg_check_num is for just checking the
number of arguments is correct. mp_arg_parse_all is for parsing
positional and keyword arguments with default values.
Diffstat (limited to 'py/objarray.c')
-rw-r--r-- | py/objarray.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objarray.c b/py/objarray.c index 2255e29d7b..cf8b1ed4eb 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -75,7 +75,7 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) { } STATIC mp_obj_t array_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { - mp_check_nargs(n_args, 1, 2, n_kw, false); + mp_arg_check_num(n_args, n_kw, 1, 2, false); // get typecode uint l; @@ -91,7 +91,7 @@ STATIC mp_obj_t array_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m } STATIC mp_obj_t bytearray_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { - mp_check_nargs(n_args, 0, 1, n_kw, false); + mp_arg_check_num(n_args, n_kw, 0, 1, false); if (n_args == 0) { // no args: construct an empty bytearray |