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.
diff --git a/py/objarray.c b/py/objarray.c
index 2255e29..cf8b1ed 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -75,7 +75,7 @@
}
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 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