From 491cbd6a7cd0a212e28c548789db432b4e64327e Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 6 May 2014 16:38:54 +0000 Subject: py: Add keyword arg support to enumerate constructor. Need to have a policy as to how far we go adding keyword support to built ins. It's nice to have, and gets better CPython compatibility, but hurts the micro nature of uPy. Addresses issue #577. --- py/argcheck.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'py/argcheck.c') diff --git a/py/argcheck.c b/py/argcheck.c index 924a60c45..bb26bd3ae 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -103,3 +103,9 @@ void mp_arg_parse_all(uint n_pos, const mp_obj_t *pos, mp_map_t *kws, uint n_all nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "extra keyword arguments given")); } } + +void mp_arg_parse_all_kw_array(uint n_pos, uint n_kw, const mp_obj_t *args, uint n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals) { + mp_map_t kw_args; + mp_map_init_fixed_table(&kw_args, n_kw, args + n_pos); + mp_arg_parse_all(n_pos, args, &kw_args, n_allowed, allowed, out_vals); +} -- cgit v1.2.3