From a3f94e0030dc209f4d180531878cede7a1e2dbbe Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 20 Apr 2014 00:13:22 +0100 Subject: 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. --- py/objarray.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'py/objarray.c') 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 -- cgit v1.2.3