py: Change type signature of builtin funs that take variable or kw args.

With this patch the n_args parameter is changed type from mp_uint_t to
size_t.
This commit is contained in:
Damien George 2016-01-03 14:21:40 +00:00
parent a0c97814df
commit 4b72b3a133
34 changed files with 102 additions and 102 deletions

View File

@ -45,7 +45,7 @@ mp_import_stat_t mp_import_stat(const char *path) {
return MP_IMPORT_STAT_NO_EXIST; return MP_IMPORT_STAT_NO_EXIST;
} }
mp_obj_t mp_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_const_none; return mp_const_none;
} }
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open); MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);

View File

@ -34,7 +34,7 @@
#include "modubinascii.h" #include "modubinascii.h"
mp_obj_t mod_binascii_hexlify(mp_uint_t n_args, const mp_obj_t *args) { mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args) {
// Second argument is for an extension to allow a separator to be used // Second argument is for an extension to allow a separator to be used
// between values. // between values.
const char *sep = NULL; const char *sep = NULL;

View File

@ -27,7 +27,7 @@
#ifndef MICROPY_EXTMOD_MODUBINASCII #ifndef MICROPY_EXTMOD_MODUBINASCII
#define MICROPY_EXTMOD_MODUBINASCII #define MICROPY_EXTMOD_MODUBINASCII
extern mp_obj_t mod_binascii_hexlify(mp_uint_t n_args, const mp_obj_t *args); extern mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args);
extern mp_obj_t mod_binascii_unhexlify(mp_obj_t data); extern mp_obj_t mod_binascii_unhexlify(mp_obj_t data);
extern mp_obj_t mod_binascii_a2b_base64(mp_obj_t data); extern mp_obj_t mod_binascii_a2b_base64(mp_obj_t data);
extern mp_obj_t mod_binascii_b2a_base64(mp_obj_t data); extern mp_obj_t mod_binascii_b2a_base64(mp_obj_t data);

View File

@ -115,17 +115,17 @@ STATIC mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
return MP_OBJ_FROM_PTR(match); return MP_OBJ_FROM_PTR(match);
} }
STATIC mp_obj_t re_match(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t re_match(size_t n_args, const mp_obj_t *args) {
return re_exec(true, n_args, args); return re_exec(true, n_args, args);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_match_obj, 2, 4, re_match); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_match_obj, 2, 4, re_match);
STATIC mp_obj_t re_search(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t re_search(size_t n_args, const mp_obj_t *args) {
return re_exec(false, n_args, args); return re_exec(false, n_args, args);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_search_obj, 2, 4, re_search); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_search_obj, 2, 4, re_search);
STATIC mp_obj_t re_split(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) {
mp_obj_re_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_re_t *self = MP_OBJ_TO_PTR(args[0]);
Subject subj; Subject subj;
mp_uint_t len; mp_uint_t len;
@ -182,7 +182,7 @@ STATIC const mp_obj_type_t re_type = {
.locals_dict = (void*)&re_locals_dict, .locals_dict = (void*)&re_locals_dict,
}; };
STATIC mp_obj_t mod_re_compile(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) {
const char *re_str = mp_obj_str_get_str(args[0]); const char *re_str = mp_obj_str_get_str(args[0]);
int size = re1_5_sizecode(re_str); int size = re1_5_sizecode(re_str);
if (size == -1) { if (size == -1) {
@ -215,12 +215,12 @@ STATIC mp_obj_t mod_re_exec(bool is_anchored, uint n_args, const mp_obj_t *args)
return match; return match;
} }
STATIC mp_obj_t mod_re_match(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_re_match(size_t n_args, const mp_obj_t *args) {
return mod_re_exec(true, n_args, args); return mod_re_exec(true, n_args, args);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_match_obj, 2, 4, mod_re_match); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_match_obj, 2, 4, mod_re_match);
STATIC mp_obj_t mod_re_search(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_re_search(size_t n_args, const mp_obj_t *args) {
return mod_re_exec(false, n_args, args); return mod_re_exec(false, n_args, args);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_search_obj, 2, 4, mod_re_search); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_search_obj, 2, 4, mod_re_search);

View File

@ -49,7 +49,7 @@ STATIC int mod_uzlib_grow_buf(TINF_DATA *d, unsigned alloc_req) {
return 0; return 0;
} }
STATIC mp_obj_t mod_uzlib_decompress(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {
(void)n_args; (void)n_args;
mp_obj_t data = args[0]; mp_obj_t data = args[0];
mp_buffer_info_t bufinfo; mp_buffer_info_t bufinfo;

View File

@ -28,9 +28,9 @@
#include "py/obj.h" #include "py/obj.h"
mp_obj_t mp_builtin___import__(mp_uint_t n_args, const mp_obj_t *args); mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args);
mp_obj_t mp_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs); mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
mp_obj_t mp_micropython_mem_info(mp_uint_t n_args, const mp_obj_t *args); mp_obj_t mp_micropython_mem_info(size_t n_args, const mp_obj_t *args);
MP_DECLARE_CONST_FUN_OBJ(mp_builtin___build_class___obj); MP_DECLARE_CONST_FUN_OBJ(mp_builtin___build_class___obj);
MP_DECLARE_CONST_FUN_OBJ(mp_builtin___import___obj); MP_DECLARE_CONST_FUN_OBJ(mp_builtin___import___obj);

View File

@ -74,7 +74,7 @@ STATIC mp_obj_t code_execute(mp_obj_code_t *self, mp_obj_dict_t *globals, mp_obj
} }
} }
STATIC mp_obj_t mp_builtin_compile(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_compile(size_t n_args, const mp_obj_t *args) {
(void)n_args; (void)n_args;
// get the source // get the source
@ -109,7 +109,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_compile_obj, 3, 6, mp_builtin_com
#if MICROPY_PY_BUILTINS_EVAL_EXEC #if MICROPY_PY_BUILTINS_EVAL_EXEC
STATIC mp_obj_t eval_exec_helper(mp_uint_t n_args, const mp_obj_t *args, mp_parse_input_kind_t parse_input_kind) { STATIC mp_obj_t eval_exec_helper(size_t n_args, const mp_obj_t *args, mp_parse_input_kind_t parse_input_kind) {
// work out the context // work out the context
mp_obj_dict_t *globals = mp_globals_get(); mp_obj_dict_t *globals = mp_globals_get();
mp_obj_dict_t *locals = mp_locals_get(); mp_obj_dict_t *locals = mp_locals_get();
@ -147,12 +147,12 @@ STATIC mp_obj_t eval_exec_helper(mp_uint_t n_args, const mp_obj_t *args, mp_pars
return mp_parse_compile_execute(lex, parse_input_kind, globals, locals); return mp_parse_compile_execute(lex, parse_input_kind, globals, locals);
} }
STATIC mp_obj_t mp_builtin_eval(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_eval(size_t n_args, const mp_obj_t *args) {
return eval_exec_helper(n_args, args, MP_PARSE_EVAL_INPUT); return eval_exec_helper(n_args, args, MP_PARSE_EVAL_INPUT);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_eval_obj, 1, 3, mp_builtin_eval); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_eval_obj, 1, 3, mp_builtin_eval);
STATIC mp_obj_t mp_builtin_exec(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_exec(size_t n_args, const mp_obj_t *args) {
return eval_exec_helper(n_args, args, MP_PARSE_FILE_INPUT); return eval_exec_helper(n_args, args, MP_PARSE_FILE_INPUT);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj, 1, 3, mp_builtin_exec); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj, 1, 3, mp_builtin_exec);
@ -160,7 +160,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj, 1, 3, mp_builtin_exec);
#endif // MICROPY_PY_BUILTINS_EVAL_EXEC #endif // MICROPY_PY_BUILTINS_EVAL_EXEC
#if MICROPY_PY_BUILTINS_EXECFILE #if MICROPY_PY_BUILTINS_EXECFILE
STATIC mp_obj_t mp_builtin_execfile(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_execfile(size_t n_args, const mp_obj_t *args) {
// MP_PARSE_SINGLE_INPUT is used to indicate a file input // MP_PARSE_SINGLE_INPUT is used to indicate a file input
return eval_exec_helper(n_args, args, MP_PARSE_SINGLE_INPUT); return eval_exec_helper(n_args, args, MP_PARSE_SINGLE_INPUT);
} }

View File

@ -215,7 +215,7 @@ STATIC void chop_component(const char *start, const char **end) {
*end = p; *end = p;
} }
mp_obj_t mp_builtin___import__(mp_uint_t n_args, const mp_obj_t *args) { mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
#if DEBUG_PRINT #if DEBUG_PRINT
DEBUG_printf("__import__:\n"); DEBUG_printf("__import__:\n");
for (mp_uint_t i = 0; i < n_args; i++) { for (mp_uint_t i = 0; i < n_args; i++) {

View File

@ -48,7 +48,7 @@ extern struct _mp_dummy_t mp_sys_stdout_obj; // type is irrelevant, just need po
// args[0] is function from class body // args[0] is function from class body
// args[1] is class name // args[1] is class name
// args[2:] are base objects // args[2:] are base objects
STATIC mp_obj_t mp_builtin___build_class__(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin___build_class__(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args); assert(2 <= n_args);
// set the new classes __locals__ object // set the new classes __locals__ object
@ -193,7 +193,7 @@ STATIC mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
} }
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_chr_obj, mp_builtin_chr); MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_chr_obj, mp_builtin_chr);
STATIC mp_obj_t mp_builtin_dir(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_dir(size_t n_args, const mp_obj_t *args) {
// TODO make this function more general and less of a hack // TODO make this function more general and less of a hack
mp_obj_dict_t *dict = NULL; mp_obj_dict_t *dict = NULL;
@ -264,7 +264,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_iter_obj, mp_builtin_iter);
#if MICROPY_PY_BUILTINS_MIN_MAX #if MICROPY_PY_BUILTINS_MIN_MAX
STATIC mp_obj_t mp_builtin_min_max(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs, mp_uint_t op) { STATIC mp_obj_t mp_builtin_min_max(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs, mp_uint_t op) {
mp_map_elem_t *key_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_key), MP_MAP_LOOKUP); mp_map_elem_t *key_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_key), MP_MAP_LOOKUP);
mp_map_elem_t *default_elem; mp_map_elem_t *default_elem;
mp_obj_t key_fn = key_elem == NULL ? MP_OBJ_NULL : key_elem->value; mp_obj_t key_fn = key_elem == NULL ? MP_OBJ_NULL : key_elem->value;
@ -305,12 +305,12 @@ STATIC mp_obj_t mp_builtin_min_max(mp_uint_t n_args, const mp_obj_t *args, mp_ma
} }
} }
STATIC mp_obj_t mp_builtin_max(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { STATIC mp_obj_t mp_builtin_max(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_MORE); return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_MORE);
} }
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_max_obj, 1, mp_builtin_max); MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_max_obj, 1, mp_builtin_max);
STATIC mp_obj_t mp_builtin_min(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { STATIC mp_obj_t mp_builtin_min(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_LESS); return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_LESS);
} }
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_min_obj, 1, mp_builtin_min); MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_min_obj, 1, mp_builtin_min);
@ -375,7 +375,7 @@ STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) {
} }
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_ord_obj, mp_builtin_ord); MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_ord_obj, mp_builtin_ord);
STATIC mp_obj_t mp_builtin_pow(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_pow(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3); assert(2 <= n_args && n_args <= 3);
switch (n_args) { switch (n_args) {
case 2: return mp_binary_op(MP_BINARY_OP_POWER, args[0], args[1]); case 2: return mp_binary_op(MP_BINARY_OP_POWER, args[0], args[1]);
@ -384,7 +384,7 @@ STATIC mp_obj_t mp_builtin_pow(mp_uint_t n_args, const mp_obj_t *args) {
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_pow_obj, 2, 3, mp_builtin_pow); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_pow_obj, 2, 3, mp_builtin_pow);
STATIC mp_obj_t mp_builtin_print(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { STATIC mp_obj_t mp_builtin_print(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
mp_map_elem_t *sep_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_sep), MP_MAP_LOOKUP); mp_map_elem_t *sep_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_sep), MP_MAP_LOOKUP);
mp_map_elem_t *end_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_end), MP_MAP_LOOKUP); mp_map_elem_t *end_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_end), MP_MAP_LOOKUP);
const char *sep_data = " "; const char *sep_data = " ";
@ -456,7 +456,7 @@ STATIC mp_obj_t mp_builtin_repr(mp_obj_t o_in) {
} }
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_repr_obj, mp_builtin_repr); MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_repr_obj, mp_builtin_repr);
STATIC mp_obj_t mp_builtin_round(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_round(size_t n_args, const mp_obj_t *args) {
mp_obj_t o_in = args[0]; mp_obj_t o_in = args[0];
if (MP_OBJ_IS_INT(o_in)) { if (MP_OBJ_IS_INT(o_in)) {
return o_in; return o_in;
@ -490,7 +490,7 @@ STATIC mp_obj_t mp_builtin_round(mp_uint_t n_args, const mp_obj_t *args) {
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_round_obj, 1, 2, mp_builtin_round); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_round_obj, 1, 2, mp_builtin_round);
STATIC mp_obj_t mp_builtin_sum(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_sum(size_t n_args, const mp_obj_t *args) {
assert(1 <= n_args && n_args <= 2); assert(1 <= n_args && n_args <= 2);
mp_obj_t value; mp_obj_t value;
switch (n_args) { switch (n_args) {
@ -506,7 +506,7 @@ STATIC mp_obj_t mp_builtin_sum(mp_uint_t n_args, const mp_obj_t *args) {
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_sum_obj, 1, 2, mp_builtin_sum); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_sum_obj, 1, 2, mp_builtin_sum);
STATIC mp_obj_t mp_builtin_sorted(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { STATIC mp_obj_t mp_builtin_sorted(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
assert(n_args >= 1); assert(n_args >= 1);
if (n_args > 1) { if (n_args > 1) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError,
@ -535,7 +535,7 @@ STATIC inline mp_obj_t mp_load_attr_default(mp_obj_t base, qstr attr, mp_obj_t d
} }
} }
STATIC mp_obj_t mp_builtin_getattr(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_getattr(size_t n_args, const mp_obj_t *args) {
mp_obj_t defval = MP_OBJ_NULL; mp_obj_t defval = MP_OBJ_NULL;
if (n_args > 2) { if (n_args > 2) {
defval = args[2]; defval = args[2];

View File

@ -152,7 +152,7 @@ MATH_FUN_1(lgamma, lgamma)
// Function that takes a variable number of arguments // Function that takes a variable number of arguments
// log(x[, base]) // log(x[, base])
STATIC mp_obj_t mp_math_log(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) {
mp_float_t x = mp_obj_get_float(args[0]); mp_float_t x = mp_obj_get_float(args[0]);
if (x <= (mp_float_t)0.0) { if (x <= (mp_float_t)0.0) {
math_error(); math_error();

View File

@ -53,7 +53,7 @@ STATIC mp_obj_t mp_micropython_mem_peak(void) {
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_mem_peak_obj, mp_micropython_mem_peak); STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_mem_peak_obj, mp_micropython_mem_peak);
#endif #endif
mp_obj_t mp_micropython_mem_info(mp_uint_t n_args, const mp_obj_t *args) { mp_obj_t mp_micropython_mem_info(size_t n_args, const mp_obj_t *args) {
(void)args; (void)args;
#if MICROPY_MEM_STATS #if MICROPY_MEM_STATS
mp_printf(&mp_plat_print, "mem: total=" UINT_FMT ", current=" UINT_FMT ", peak=" UINT_FMT "\n", mp_printf(&mp_plat_print, "mem: total=" UINT_FMT ", current=" UINT_FMT ", peak=" UINT_FMT "\n",
@ -77,7 +77,7 @@ mp_obj_t mp_micropython_mem_info(mp_uint_t n_args, const mp_obj_t *args) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_mem_info_obj, 0, 1, mp_micropython_mem_info); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_mem_info_obj, 0, 1, mp_micropython_mem_info);
STATIC mp_obj_t mp_micropython_qstr_info(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_micropython_qstr_info(size_t n_args, const mp_obj_t *args) {
(void)args; (void)args;
size_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes; size_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes); qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);

View File

@ -165,7 +165,7 @@ STATIC mp_obj_t struct_unpack(mp_obj_t fmt_in, mp_obj_t data_in) {
} }
MP_DEFINE_CONST_FUN_OBJ_2(struct_unpack_obj, struct_unpack); MP_DEFINE_CONST_FUN_OBJ_2(struct_unpack_obj, struct_unpack);
STATIC mp_obj_t struct_pack(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) {
// TODO: "The arguments must match the values required by the format exactly." // TODO: "The arguments must match the values required by the format exactly."
const char *fmt = mp_obj_str_get_str(args[0]); const char *fmt = mp_obj_str_get_str(args[0]);
char fmt_type = get_fmt_type(&fmt); char fmt_type = get_fmt_type(&fmt);

View File

@ -93,7 +93,7 @@ STATIC const MP_DEFINE_STR_OBJ(platform_obj, MICROPY_PY_SYS_PLATFORM);
/// \function exit([retval]) /// \function exit([retval])
/// Raise a `SystemExit` exception. If an argument is given, it is the /// Raise a `SystemExit` exception. If an argument is given, it is the
/// value given to `SystemExit`. /// value given to `SystemExit`.
STATIC mp_obj_t mp_sys_exit(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) {
mp_obj_t exc; mp_obj_t exc;
if (n_args == 0) { if (n_args == 0) {
exc = mp_obj_new_exception(&mp_type_SystemExit); exc = mp_obj_new_exception(&mp_type_SystemExit);
@ -104,7 +104,7 @@ STATIC mp_obj_t mp_sys_exit(mp_uint_t n_args, const mp_obj_t *args) {
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit);
STATIC mp_obj_t mp_sys_print_exception(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_sys_print_exception(size_t n_args, const mp_obj_t *args) {
#if MICROPY_PY_IO #if MICROPY_PY_IO
void *stream_obj = &mp_sys_stdout_obj; void *stream_obj = &mp_sys_stdout_obj;
if (n_args > 1) { if (n_args > 1) {

View File

@ -395,8 +395,8 @@ typedef mp_obj_t (*mp_fun_0_t)(void);
typedef mp_obj_t (*mp_fun_1_t)(mp_obj_t); typedef mp_obj_t (*mp_fun_1_t)(mp_obj_t);
typedef mp_obj_t (*mp_fun_2_t)(mp_obj_t, mp_obj_t); typedef mp_obj_t (*mp_fun_2_t)(mp_obj_t, mp_obj_t);
typedef mp_obj_t (*mp_fun_3_t)(mp_obj_t, mp_obj_t, mp_obj_t); typedef mp_obj_t (*mp_fun_3_t)(mp_obj_t, mp_obj_t, mp_obj_t);
typedef mp_obj_t (*mp_fun_var_t)(mp_uint_t n, const mp_obj_t *); typedef mp_obj_t (*mp_fun_var_t)(size_t n, const mp_obj_t *);
typedef mp_obj_t (*mp_fun_kw_t)(mp_uint_t n, const mp_obj_t *, mp_map_t *); typedef mp_obj_t (*mp_fun_kw_t)(size_t n, const mp_obj_t *, mp_map_t *);
typedef enum { typedef enum {
PRINT_STR = 0, PRINT_STR = 0,
@ -725,7 +725,7 @@ mp_obj_t mp_obj_list_remove(mp_obj_t self_in, mp_obj_t value);
void mp_obj_list_get(mp_obj_t self_in, mp_uint_t *len, mp_obj_t **items); void mp_obj_list_get(mp_obj_t self_in, mp_uint_t *len, mp_obj_t **items);
void mp_obj_list_set_len(mp_obj_t self_in, mp_uint_t len); void mp_obj_list_set_len(mp_obj_t self_in, mp_uint_t len);
void mp_obj_list_store(mp_obj_t self_in, mp_obj_t index, mp_obj_t value); void mp_obj_list_store(mp_obj_t self_in, mp_obj_t index, mp_obj_t value);
mp_obj_t mp_obj_list_sort(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs); mp_obj_t mp_obj_list_sort(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
// dict // dict
typedef struct _mp_obj_dict_t { typedef struct _mp_obj_dict_t {

View File

@ -36,7 +36,7 @@
#define MP_OBJ_IS_DICT_TYPE(o) (MP_OBJ_IS_OBJ(o) && ((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type->make_new == dict_make_new) #define MP_OBJ_IS_DICT_TYPE(o) (MP_OBJ_IS_OBJ(o) && ((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type->make_new == dict_make_new)
STATIC mp_obj_t dict_update(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs); STATIC mp_obj_t dict_update(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
// This is a helper function to iterate through a dictionary. The state of // This is a helper function to iterate through a dictionary. The state of
// the iteration is held in *cur and should be initialised with zero for the // the iteration is held in *cur and should be initialised with zero for the
@ -240,7 +240,7 @@ STATIC mp_obj_t dict_copy(mp_obj_t self_in) {
STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_copy_obj, dict_copy); STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_copy_obj, dict_copy);
// this is a classmethod // this is a classmethod
STATIC mp_obj_t dict_fromkeys(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t dict_fromkeys(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3); assert(2 <= n_args && n_args <= 3);
mp_obj_t iter = mp_getiter(args[1]); mp_obj_t iter = mp_getiter(args[1]);
mp_obj_t len = mp_obj_len_maybe(iter); mp_obj_t len = mp_obj_len_maybe(iter);
@ -294,7 +294,7 @@ STATIC mp_obj_t dict_get_helper(mp_map_t *self, mp_obj_t key, mp_obj_t deflt, mp
return value; return value;
} }
STATIC mp_obj_t dict_get(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t dict_get(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3); assert(2 <= n_args && n_args <= 3);
assert(MP_OBJ_IS_DICT_TYPE(args[0])); assert(MP_OBJ_IS_DICT_TYPE(args[0]));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
@ -306,7 +306,7 @@ STATIC mp_obj_t dict_get(mp_uint_t n_args, const mp_obj_t *args) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_get_obj, 2, 3, dict_get); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_get_obj, 2, 3, dict_get);
STATIC mp_obj_t dict_pop(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t dict_pop(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3); assert(2 <= n_args && n_args <= 3);
assert(MP_OBJ_IS_DICT_TYPE(args[0])); assert(MP_OBJ_IS_DICT_TYPE(args[0]));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
@ -319,7 +319,7 @@ STATIC mp_obj_t dict_pop(mp_uint_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_pop_obj, 2, 3, dict_pop); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_pop_obj, 2, 3, dict_pop);
STATIC mp_obj_t dict_setdefault(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t dict_setdefault(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3); assert(2 <= n_args && n_args <= 3);
assert(MP_OBJ_IS_DICT_TYPE(args[0])); assert(MP_OBJ_IS_DICT_TYPE(args[0]));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
@ -350,7 +350,7 @@ STATIC mp_obj_t dict_popitem(mp_obj_t self_in) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_popitem_obj, dict_popitem); STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_popitem_obj, dict_popitem);
STATIC mp_obj_t dict_update(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { STATIC mp_obj_t dict_update(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
assert(MP_OBJ_IS_DICT_TYPE(args[0])); assert(MP_OBJ_IS_DICT_TYPE(args[0]));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);

View File

@ -153,7 +153,7 @@ STATIC void exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
} }
} }
STATIC mp_obj_t exc___init__(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t exc___init__(size_t n_args, const mp_obj_t *args) {
mp_obj_exception_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_exception_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_t argst = mp_obj_new_tuple(n_args - 1, args + 1); mp_obj_t argst = mp_obj_new_tuple(n_args - 1, args + 1);
self->args = MP_OBJ_TO_PTR(argst); self->args = MP_OBJ_TO_PTR(argst);

View File

@ -190,7 +190,7 @@ STATIC mp_obj_t gen_instance_send(mp_obj_t self_in, mp_obj_t send_value) {
STATIC MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_send_obj, gen_instance_send); STATIC MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_send_obj, gen_instance_send);
STATIC mp_obj_t gen_instance_close(mp_obj_t self_in); STATIC mp_obj_t gen_instance_close(mp_obj_t self_in);
STATIC mp_obj_t gen_instance_throw(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t gen_instance_throw(size_t n_args, const mp_obj_t *args) {
mp_obj_t exc = (n_args == 2) ? args[1] : args[2]; mp_obj_t exc = (n_args == 2) ? args[1] : args[2];
exc = mp_make_raise_obj(exc); exc = mp_make_raise_obj(exc);

View File

@ -381,7 +381,7 @@ mp_obj_t mp_obj_int_binary_op_extra_cases(mp_uint_t op, mp_obj_t lhs_in, mp_obj_
} }
// this is a classmethod // this is a classmethod
STATIC mp_obj_t int_from_bytes(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) {
// TODO: Support long ints // TODO: Support long ints
// TODO: Support byteorder param (assumes 'little' at the moment) // TODO: Support byteorder param (assumes 'little' at the moment)
// TODO: Support signed param (assumes signed=False at the moment) // TODO: Support signed param (assumes signed=False at the moment)
@ -403,7 +403,7 @@ STATIC mp_obj_t int_from_bytes(mp_uint_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_from_bytes_fun_obj, 2, 3, int_from_bytes); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_from_bytes_fun_obj, 2, 3, int_from_bytes);
STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(int_from_bytes_obj, MP_ROM_PTR(&int_from_bytes_fun_obj)); STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(int_from_bytes_obj, MP_ROM_PTR(&int_from_bytes_fun_obj));
STATIC mp_obj_t int_to_bytes(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *args) {
// TODO: Support byteorder param (assumes 'little') // TODO: Support byteorder param (assumes 'little')
// TODO: Support signed param (assumes signed=False) // TODO: Support signed param (assumes signed=False)
(void)n_args; (void)n_args;

View File

@ -36,7 +36,7 @@
STATIC mp_obj_t mp_obj_new_list_iterator(mp_obj_t list, mp_uint_t cur); STATIC mp_obj_t mp_obj_new_list_iterator(mp_obj_t list, mp_uint_t cur);
STATIC mp_obj_list_t *list_new(mp_uint_t n); STATIC mp_obj_list_t *list_new(mp_uint_t n);
STATIC mp_obj_t list_extend(mp_obj_t self_in, mp_obj_t arg_in); STATIC mp_obj_t list_extend(mp_obj_t self_in, mp_obj_t arg_in);
STATIC mp_obj_t list_pop(mp_uint_t n_args, const mp_obj_t *args); STATIC mp_obj_t list_pop(size_t n_args, const mp_obj_t *args);
// TODO: Move to mpconfig.h // TODO: Move to mpconfig.h
#define LIST_MIN_ALLOC 4 #define LIST_MIN_ALLOC 4
@ -262,7 +262,7 @@ STATIC mp_obj_t list_extend(mp_obj_t self_in, mp_obj_t arg_in) {
return mp_const_none; // return None, as per CPython return mp_const_none; // return None, as per CPython
} }
STATIC mp_obj_t list_pop(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t list_pop(size_t n_args, const mp_obj_t *args) {
assert(1 <= n_args && n_args <= 2); assert(1 <= n_args && n_args <= 2);
assert(MP_OBJ_IS_TYPE(args[0], &mp_type_list)); assert(MP_OBJ_IS_TYPE(args[0], &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_list_t *self = MP_OBJ_TO_PTR(args[0]);
@ -311,7 +311,7 @@ STATIC void mp_quicksort(mp_obj_t *head, mp_obj_t *tail, mp_obj_t key_fn, mp_obj
} }
// TODO Python defines sort to be stable but ours is not // TODO Python defines sort to be stable but ours is not
mp_obj_t mp_obj_list_sort(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mp_obj_t mp_obj_list_sort(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {
{ MP_QSTR_key, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} }, { MP_QSTR_key, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
{ MP_QSTR_reverse, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, { MP_QSTR_reverse, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
@ -355,7 +355,7 @@ STATIC mp_obj_t list_count(mp_obj_t self_in, mp_obj_t value) {
return mp_seq_count_obj(self->items, self->len, value); return mp_seq_count_obj(self->items, self->len, value);
} }
STATIC mp_obj_t list_index(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t list_index(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 4); assert(2 <= n_args && n_args <= 4);
assert(MP_OBJ_IS_TYPE(args[0], &mp_type_list)); assert(MP_OBJ_IS_TYPE(args[0], &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_list_t *self = MP_OBJ_TO_PTR(args[0]);

View File

@ -223,7 +223,7 @@ STATIC mp_obj_t set_discard(mp_obj_t self_in, mp_obj_t item) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_discard_obj, set_discard); STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_discard_obj, set_discard);
STATIC mp_obj_t set_diff_int(mp_uint_t n_args, const mp_obj_t *args, bool update) { STATIC mp_obj_t set_diff_int(size_t n_args, const mp_obj_t *args, bool update) {
assert(n_args > 0); assert(n_args > 0);
mp_obj_t self; mp_obj_t self;
@ -253,12 +253,12 @@ STATIC mp_obj_t set_diff_int(mp_uint_t n_args, const mp_obj_t *args, bool update
return self; return self;
} }
STATIC mp_obj_t set_diff(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t set_diff(size_t n_args, const mp_obj_t *args) {
return set_diff_int(n_args, args, false); return set_diff_int(n_args, args, false);
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR(set_diff_obj, 1, set_diff); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR(set_diff_obj, 1, set_diff);
STATIC mp_obj_t set_diff_update(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t set_diff_update(size_t n_args, const mp_obj_t *args) {
set_diff_int(n_args, args, true); set_diff_int(n_args, args, true);
return mp_const_none; return mp_const_none;
} }
@ -442,7 +442,7 @@ STATIC void set_update_int(mp_obj_set_t *self, mp_obj_t other_in) {
} }
} }
STATIC mp_obj_t set_update(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t set_update(size_t n_args, const mp_obj_t *args) {
assert(n_args > 0); assert(n_args > 0);
for (mp_uint_t i = 1; i < n_args; i++) { for (mp_uint_t i = 1; i < n_args; i++) {

View File

@ -546,12 +546,12 @@ STATIC inline mp_obj_t str_split_internal(mp_uint_t n_args, const mp_obj_t *args
return res; return res;
} }
mp_obj_t mp_obj_str_split(mp_uint_t n_args, const mp_obj_t *args) { mp_obj_t mp_obj_str_split(size_t n_args, const mp_obj_t *args) {
return str_split_internal(n_args, args, SPLIT); return str_split_internal(n_args, args, SPLIT);
} }
#if MICROPY_PY_BUILTINS_STR_SPLITLINES #if MICROPY_PY_BUILTINS_STR_SPLITLINES
STATIC mp_obj_t str_splitlines(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { STATIC mp_obj_t str_splitlines(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {
{ MP_QSTR_keepends, MP_ARG_BOOL, {.u_bool = false} }, { MP_QSTR_keepends, MP_ARG_BOOL, {.u_bool = false} },
}; };
@ -565,7 +565,7 @@ STATIC mp_obj_t str_splitlines(mp_uint_t n_args, const mp_obj_t *pos_args, mp_ma
} }
#endif #endif
STATIC mp_obj_t str_rsplit(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args) {
if (n_args < 3) { if (n_args < 3) {
// If we don't have split limit, it doesn't matter from which side // If we don't have split limit, it doesn't matter from which side
// we split. // we split.
@ -667,24 +667,24 @@ STATIC mp_obj_t str_finder(mp_uint_t n_args, const mp_obj_t *args, mp_int_t dire
} }
} }
STATIC mp_obj_t str_find(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_find(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, 1, false); return str_finder(n_args, args, 1, false);
} }
STATIC mp_obj_t str_rfind(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_rfind(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, -1, false); return str_finder(n_args, args, -1, false);
} }
STATIC mp_obj_t str_index(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_index(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, 1, true); return str_finder(n_args, args, 1, true);
} }
STATIC mp_obj_t str_rindex(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_rindex(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, -1, true); return str_finder(n_args, args, -1, true);
} }
// TODO: (Much) more variety in args // TODO: (Much) more variety in args
STATIC mp_obj_t str_startswith(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_startswith(size_t n_args, const mp_obj_t *args) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]); const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
GET_STR_DATA_LEN(args[0], str, str_len); GET_STR_DATA_LEN(args[0], str, str_len);
GET_STR_DATA_LEN(args[1], prefix, prefix_len); GET_STR_DATA_LEN(args[1], prefix, prefix_len);
@ -698,7 +698,7 @@ STATIC mp_obj_t str_startswith(mp_uint_t n_args, const mp_obj_t *args) {
return mp_obj_new_bool(memcmp(start, prefix, prefix_len) == 0); return mp_obj_new_bool(memcmp(start, prefix, prefix_len) == 0);
} }
STATIC mp_obj_t str_endswith(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_endswith(size_t n_args, const mp_obj_t *args) {
GET_STR_DATA_LEN(args[0], str, str_len); GET_STR_DATA_LEN(args[0], str, str_len);
GET_STR_DATA_LEN(args[1], suffix, suffix_len); GET_STR_DATA_LEN(args[1], suffix, suffix_len);
if (n_args > 2) { if (n_args > 2) {
@ -785,15 +785,15 @@ STATIC mp_obj_t str_uni_strip(int type, mp_uint_t n_args, const mp_obj_t *args)
return mp_obj_new_str_of_type(self_type, orig_str + first_good_char_pos, stripped_len); return mp_obj_new_str_of_type(self_type, orig_str + first_good_char_pos, stripped_len);
} }
STATIC mp_obj_t str_strip(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_strip(size_t n_args, const mp_obj_t *args) {
return str_uni_strip(STRIP, n_args, args); return str_uni_strip(STRIP, n_args, args);
} }
STATIC mp_obj_t str_lstrip(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_lstrip(size_t n_args, const mp_obj_t *args) {
return str_uni_strip(LSTRIP, n_args, args); return str_uni_strip(LSTRIP, n_args, args);
} }
STATIC mp_obj_t str_rstrip(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_rstrip(size_t n_args, const mp_obj_t *args) {
return str_uni_strip(RSTRIP, n_args, args); return str_uni_strip(RSTRIP, n_args, args);
} }
@ -845,7 +845,7 @@ STATIC NORETURN void terse_str_format_value_error(void) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "bad format string")); nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "bad format string"));
} }
mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { mp_obj_t mp_obj_str_format(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
assert(MP_OBJ_IS_STR_OR_BYTES(args[0])); assert(MP_OBJ_IS_STR_OR_BYTES(args[0]));
GET_STR_DATA_LEN(args[0], str, len); GET_STR_DATA_LEN(args[0], str, len);
@ -1486,7 +1486,7 @@ not_enough_args:
// The implementation is optimized, returning the original string if there's // The implementation is optimized, returning the original string if there's
// nothing to replace. // nothing to replace.
STATIC mp_obj_t str_replace(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_replace(size_t n_args, const mp_obj_t *args) {
assert(MP_OBJ_IS_STR_OR_BYTES(args[0])); assert(MP_OBJ_IS_STR_OR_BYTES(args[0]));
mp_int_t max_rep = -1; mp_int_t max_rep = -1;
@ -1591,7 +1591,7 @@ STATIC mp_obj_t str_replace(mp_uint_t n_args, const mp_obj_t *args) {
return mp_obj_new_str_from_vstr(self_type, &vstr); return mp_obj_new_str_from_vstr(self_type, &vstr);
} }
STATIC mp_obj_t str_count(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_count(size_t n_args, const mp_obj_t *args) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]); const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
assert(2 <= n_args && n_args <= 4); assert(2 <= n_args && n_args <= 4);
assert(MP_OBJ_IS_STR_OR_BYTES(args[0])); assert(MP_OBJ_IS_STR_OR_BYTES(args[0]));
@ -1759,7 +1759,7 @@ STATIC mp_obj_t str_islower(mp_obj_t self_in) {
// These methods are superfluous in the presense of str() and bytes() // These methods are superfluous in the presense of str() and bytes()
// constructors. // constructors.
// TODO: should accept kwargs too // TODO: should accept kwargs too
STATIC mp_obj_t bytes_decode(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t bytes_decode(size_t n_args, const mp_obj_t *args) {
mp_obj_t new_args[2]; mp_obj_t new_args[2];
if (n_args == 1) { if (n_args == 1) {
new_args[0] = args[0]; new_args[0] = args[0];
@ -1771,7 +1771,7 @@ STATIC mp_obj_t bytes_decode(mp_uint_t n_args, const mp_obj_t *args) {
} }
// TODO: should accept kwargs too // TODO: should accept kwargs too
STATIC mp_obj_t str_encode(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t str_encode(size_t n_args, const mp_obj_t *args) {
mp_obj_t new_args[2]; mp_obj_t new_args[2];
if (n_args == 1) { if (n_args == 1) {
new_args[0] = args[0]; new_args[0] = args[0];

View File

@ -62,8 +62,8 @@ const byte *mp_obj_str_get_data_no_check(mp_obj_t self_in, size_t *len);
mp_obj_t mp_obj_str_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw, const mp_obj_t *args); mp_obj_t mp_obj_str_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
void mp_str_print_json(const mp_print_t *print, const byte *str_data, size_t str_len); void mp_str_print_json(const mp_print_t *print, const byte *str_data, size_t str_len);
mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs); mp_obj_t mp_obj_str_format(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
mp_obj_t mp_obj_str_split(mp_uint_t n_args, const mp_obj_t *args); mp_obj_t mp_obj_str_split(size_t n_args, const mp_obj_t *args);
mp_obj_t mp_obj_new_str_of_type(const mp_obj_type_t *type, const byte* data, size_t len); mp_obj_t mp_obj_new_str_of_type(const mp_obj_type_t *type, const byte* data, size_t len);
mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in); mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in);

View File

@ -114,7 +114,7 @@ STATIC mp_obj_t stringio_close(mp_obj_t self_in) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_1(stringio_close_obj, stringio_close); STATIC MP_DEFINE_CONST_FUN_OBJ_1(stringio_close_obj, stringio_close);
STATIC mp_obj_t stringio___exit__(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t stringio___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args; (void)n_args;
return stringio_close(args[0]); return stringio_close(args[0]);
} }

View File

@ -208,7 +208,7 @@ STATIC mp_obj_t tuple_count(mp_obj_t self_in, mp_obj_t value) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_2(tuple_count_obj, tuple_count); STATIC MP_DEFINE_CONST_FUN_OBJ_2(tuple_count_obj, tuple_count);
STATIC mp_obj_t tuple_index(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t tuple_index(size_t n_args, const mp_obj_t *args) {
assert(MP_OBJ_IS_TYPE(args[0], &mp_type_tuple)); assert(MP_OBJ_IS_TYPE(args[0], &mp_type_tuple));
mp_obj_tuple_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_tuple_t *self = MP_OBJ_TO_PTR(args[0]);
return mp_seq_index_obj(self->items, self->len, n_args, args); return mp_seq_index_obj(self->items, self->len, n_args, args);

View File

@ -62,7 +62,7 @@ const mp_stream_p_t *mp_get_stream_raise(mp_obj_t self_in, int flags) {
return stream_p; return stream_p;
} }
STATIC mp_obj_t stream_read(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t stream_read(size_t n_args, const mp_obj_t *args) {
const mp_stream_p_t *stream_p = mp_get_stream_raise(args[0], MP_STREAM_OP_READ); const mp_stream_p_t *stream_p = mp_get_stream_raise(args[0], MP_STREAM_OP_READ);
// What to do if sz < -1? Python docs don't specify this case. // What to do if sz < -1? Python docs don't specify this case.
@ -214,7 +214,7 @@ STATIC mp_obj_t stream_write_method(mp_obj_t self_in, mp_obj_t arg) {
return mp_stream_write(self_in, bufinfo.buf, bufinfo.len); return mp_stream_write(self_in, bufinfo.buf, bufinfo.len);
} }
STATIC mp_obj_t stream_readinto(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t stream_readinto(size_t n_args, const mp_obj_t *args) {
const mp_stream_p_t *stream_p = mp_get_stream_raise(args[0], MP_STREAM_OP_READ); const mp_stream_p_t *stream_p = mp_get_stream_raise(args[0], MP_STREAM_OP_READ);
mp_buffer_info_t bufinfo; mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_WRITE); mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_WRITE);
@ -287,7 +287,7 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in) {
} }
// Unbuffered, inefficient implementation of readline() for raw I/O files. // Unbuffered, inefficient implementation of readline() for raw I/O files.
STATIC mp_obj_t stream_unbuffered_readline(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t stream_unbuffered_readline(size_t n_args, const mp_obj_t *args) {
const mp_stream_p_t *stream_p = mp_get_stream_raise(args[0], MP_STREAM_OP_READ); const mp_stream_p_t *stream_p = mp_get_stream_raise(args[0], MP_STREAM_OP_READ);
mp_int_t max_size = -1; mp_int_t max_size = -1;
@ -365,7 +365,7 @@ mp_obj_t mp_stream_unbuffered_iter(mp_obj_t self) {
return MP_OBJ_STOP_ITERATION; return MP_OBJ_STOP_ITERATION;
} }
STATIC mp_obj_t stream_seek(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t stream_seek(size_t n_args, const mp_obj_t *args) {
const mp_stream_p_t *stream_p = mp_get_stream_raise(args[0], MP_STREAM_OP_IOCTL); const mp_stream_p_t *stream_p = mp_get_stream_raise(args[0], MP_STREAM_OP_IOCTL);
struct mp_stream_seek_t seek_s; struct mp_stream_seek_t seek_s;

View File

@ -52,7 +52,7 @@ mp_import_stat_t mp_import_stat(const char *path) {
return MP_IMPORT_STAT_NO_EXIST; return MP_IMPORT_STAT_NO_EXIST;
} }
mp_obj_t mp_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_const_none; return mp_const_none;
} }
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open); MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);

View File

@ -82,7 +82,7 @@ mp_import_stat_t mp_import_stat(const char *path) {
return MP_IMPORT_STAT_NO_EXIST; return MP_IMPORT_STAT_NO_EXIST;
} }
mp_obj_t mp_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_const_none; return mp_const_none;
} }
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open); MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);

View File

@ -130,7 +130,7 @@ STATIC mp_obj_t fdfile_close(mp_obj_t self_in) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_close_obj, fdfile_close); STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_close_obj, fdfile_close);
STATIC mp_obj_t fdfile___exit__(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t fdfile___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args; (void)n_args;
return fdfile_close(args[0]); return fdfile_close(args[0]);
} }
@ -264,7 +264,7 @@ const mp_obj_type_t mp_type_textio = {
}; };
// Factory function for I/O stream classes // Factory function for I/O stream classes
mp_obj_t mp_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
// TODO: analyze buffering args and instantiate appropriate type // TODO: analyze buffering args and instantiate appropriate type
mp_arg_val_t arg_vals[FILE_OPEN_NUM_ARGS]; mp_arg_val_t arg_vals[FILE_OPEN_NUM_ARGS];
mp_arg_parse_all(n_args, args, kwargs, FILE_OPEN_NUM_ARGS, file_open_args, arg_vals); mp_arg_parse_all(n_args, args, kwargs, FILE_OPEN_NUM_ARGS, file_open_args, arg_vals);

View File

@ -158,7 +158,7 @@ void prompt_write_history(void) {
#endif #endif
} }
STATIC mp_obj_t mp_builtin_input(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_input(size_t n_args, const mp_obj_t *args) {
if (n_args == 1) { if (n_args == 1) {
mp_obj_print(args[0], PRINT_STR); mp_obj_print(args[0], PRINT_STR);
} }

View File

@ -208,7 +208,7 @@ STATIC mp_obj_t make_func(mp_obj_t rettype_in, void *func, mp_obj_t argtypes_in)
return MP_OBJ_FROM_PTR(o); return MP_OBJ_FROM_PTR(o);
} }
STATIC mp_obj_t ffimod_func(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t ffimod_func(size_t n_args, const mp_obj_t *args) {
(void)n_args; // always 4 (void)n_args; // always 4
mp_obj_ffimod_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_ffimod_t *self = MP_OBJ_TO_PTR(args[0]);
const char *symname = mp_obj_str_get_str(args[2]); const char *symname = mp_obj_str_get_str(args[2]);
@ -477,7 +477,7 @@ STATIC const mp_obj_type_t opaque_type = {
}; };
*/ */
STATIC mp_obj_t mod_ffi_open(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_ffi_open(size_t n_args, const mp_obj_t *args) {
return ffimod_make_new((mp_obj_t)&ffimod_type, n_args, 0, args); return ffimod_make_new((mp_obj_t)&ffimod_type, n_args, 0, args);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_ffi_open_obj, 1, 2, mod_ffi_open); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_ffi_open_obj, 1, 2, mod_ffi_open);

View File

@ -193,7 +193,7 @@ STATIC mp_obj_t listdir_next(mp_obj_t self_in) {
return MP_OBJ_FROM_PTR(t); return MP_OBJ_FROM_PTR(t);
} }
STATIC mp_obj_t mod_os_ilistdir(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_os_ilistdir(size_t n_args, const mp_obj_t *args) {
const char *path = "."; const char *path = ".";
if (n_args > 0) { if (n_args > 0) {
path = mp_obj_str_get_str(args[0]); path = mp_obj_str_get_str(args[0]);
@ -206,7 +206,7 @@ STATIC mp_obj_t mod_os_ilistdir(mp_uint_t n_args, const mp_obj_t *args) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_ilistdir_obj, 0, 1, mod_os_ilistdir); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_ilistdir_obj, 0, 1, mod_os_ilistdir);
STATIC mp_obj_t mod_os_errno(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_os_errno(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) { if (n_args == 0) {
return MP_OBJ_NEW_SMALL_INT(errno); return MP_OBJ_NEW_SMALL_INT(errno);
} }

View File

@ -171,7 +171,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
// Note: besides flag param, this differs from read() in that // Note: besides flag param, this differs from read() in that
// this does not swallow blocking errors (EAGAIN, EWOULDBLOCK) - // this does not swallow blocking errors (EAGAIN, EWOULDBLOCK) -
// these would be thrown as exceptions. // these would be thrown as exceptions.
STATIC mp_obj_t socket_recv(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t socket_recv(size_t n_args, const mp_obj_t *args) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]);
int sz = MP_OBJ_SMALL_INT_VALUE(args[1]); int sz = MP_OBJ_SMALL_INT_VALUE(args[1]);
int flags = 0; int flags = 0;
@ -190,7 +190,7 @@ STATIC mp_obj_t socket_recv(mp_uint_t n_args, const mp_obj_t *args) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recv_obj, 2, 3, socket_recv); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recv_obj, 2, 3, socket_recv);
STATIC mp_obj_t socket_recvfrom(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t socket_recvfrom(size_t n_args, const mp_obj_t *args) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]);
int sz = MP_OBJ_SMALL_INT_VALUE(args[1]); int sz = MP_OBJ_SMALL_INT_VALUE(args[1]);
int flags = 0; int flags = 0;
@ -220,7 +220,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recvfrom_obj, 2, 3, socket_rec
// Note: besides flag param, this differs from write() in that // Note: besides flag param, this differs from write() in that
// this does not swallow blocking errors (EAGAIN, EWOULDBLOCK) - // this does not swallow blocking errors (EAGAIN, EWOULDBLOCK) -
// these would be thrown as exceptions. // these would be thrown as exceptions.
STATIC mp_obj_t socket_send(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t socket_send(size_t n_args, const mp_obj_t *args) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]);
int flags = 0; int flags = 0;
@ -237,7 +237,7 @@ STATIC mp_obj_t socket_send(mp_uint_t n_args, const mp_obj_t *args) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_send_obj, 2, 3, socket_send); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_send_obj, 2, 3, socket_send);
STATIC mp_obj_t socket_sendto(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t socket_sendto(size_t n_args, const mp_obj_t *args) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]);
int flags = 0; int flags = 0;
@ -258,7 +258,7 @@ STATIC mp_obj_t socket_sendto(mp_uint_t n_args, const mp_obj_t *args) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_sendto_obj, 3, 4, socket_sendto); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_sendto_obj, 3, 4, socket_sendto);
STATIC mp_obj_t socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
(void)n_args; // always 4 (void)n_args; // always 4
mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]);
int level = MP_OBJ_SMALL_INT_VALUE(args[1]); int level = MP_OBJ_SMALL_INT_VALUE(args[1]);
@ -299,7 +299,7 @@ STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking); STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
STATIC mp_obj_t socket_makefile(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
// TODO: CPython explicitly says that closing returned object doesn't close // TODO: CPython explicitly says that closing returned object doesn't close
// the original socket (Python2 at all says that fd is dup()ed). But we // the original socket (Python2 at all says that fd is dup()ed). But we
// save on the bloat. // save on the bloat.
@ -421,7 +421,7 @@ STATIC mp_obj_t mod_socket_inet_pton(mp_obj_t family_in, mp_obj_t addr_in) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_inet_pton_obj, mod_socket_inet_pton); STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_inet_pton_obj, mod_socket_inet_pton);
STATIC mp_obj_t mod_socket_getaddrinfo(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
// TODO: Implement all args // TODO: Implement all args
assert(n_args >= 2 && n_args <= 4); assert(n_args >= 2 && n_args <= 4);
assert(MP_OBJ_IS_STR(args[0])); assert(MP_OBJ_IS_STR(args[0]));

View File

@ -154,7 +154,7 @@ STATIC mp_obj_t mod_time_sleep_us(mp_obj_t arg) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_time_sleep_us_obj, mod_time_sleep_us); STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_time_sleep_us_obj, mod_time_sleep_us);
STATIC mp_obj_t mod_time_strftime(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_time_strftime(size_t n_args, const mp_obj_t *args) {
time_t t; time_t t;
if (n_args == 1) { if (n_args == 1) {
t = time(NULL); t = time(NULL);

View File

@ -52,7 +52,7 @@ typedef struct _mp_obj_poll_t {
} mp_obj_poll_t; } mp_obj_poll_t;
/// \method register(obj[, eventmask]) /// \method register(obj[, eventmask])
STATIC mp_obj_t poll_register(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t poll_register(size_t n_args, const mp_obj_t *args) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_poll_t *self = MP_OBJ_TO_PTR(args[0]);
int fd = mp_obj_get_int(args[1]); int fd = mp_obj_get_int(args[1]);
mp_uint_t flags; mp_uint_t flags;
@ -129,7 +129,7 @@ MP_DEFINE_CONST_FUN_OBJ_3(poll_modify_obj, poll_modify);
/// \method poll([timeout]) /// \method poll([timeout])
/// Timeout is in milliseconds. /// Timeout is in milliseconds.
STATIC mp_obj_t poll_poll(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t poll_poll(size_t n_args, const mp_obj_t *args) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_poll_t *self = MP_OBJ_TO_PTR(args[0]);
// work out timeout (it's given already in ms) // work out timeout (it's given already in ms)
@ -186,7 +186,7 @@ STATIC const mp_obj_type_t mp_type_poll = {
.locals_dict = (void*)&poll_locals_dict, .locals_dict = (void*)&poll_locals_dict,
}; };
STATIC mp_obj_t select_poll(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t select_poll(size_t n_args, const mp_obj_t *args) {
int alloc = 4; int alloc = 4;
if (n_args > 0) { if (n_args > 0) {
alloc = mp_obj_get_int(args[0]); alloc = mp_obj_get_int(args[0]);