parent
33b3a6905d
commit
47d3bd3b31
@ -103,3 +103,10 @@ 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"));
|
||||
}
|
||||
}
|
||||
|
||||
#if MICROPY_CPYTHON_COMPAT
|
||||
void mp_arg_error_unimpl_kw() {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_NotImplementedError,
|
||||
"keyword argument(s) not yet implemented - use normal args instead"));
|
||||
}
|
||||
#endif
|
||||
|
@ -41,9 +41,14 @@ typedef struct _mp_obj_enumerate_t {
|
||||
|
||||
STATIC mp_obj_t enumerate_iternext(mp_obj_t self_in);
|
||||
|
||||
/* TODO: enumerate is one of the ones that can take args or kwargs.
|
||||
Sticking to args for now */
|
||||
STATIC mp_obj_t enumerate_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
|
||||
/* TODO: enumerate is one of the ones that can take args or kwargs.
|
||||
Sticking to args for now */
|
||||
#if MICROPY_CPYTHON_COMPAT
|
||||
if (n_kw != 0) {
|
||||
mp_arg_error_unimpl_kw();
|
||||
}
|
||||
#endif
|
||||
assert(n_args > 0);
|
||||
mp_obj_enumerate_t *o = m_new_obj(mp_obj_enumerate_t);
|
||||
o->base.type = &mp_type_enumerate;
|
||||
|
@ -56,6 +56,7 @@ void mp_deinit(void);
|
||||
|
||||
void mp_arg_check_num(uint n_args, uint n_kw, uint n_args_min, uint n_args_max, bool takes_kw);
|
||||
void mp_arg_parse_all(uint n_pos, const mp_obj_t *pos, mp_map_t *kws, uint n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals);
|
||||
NORETURN void mp_arg_error_unimpl_kw();
|
||||
|
||||
mp_obj_dict_t *mp_locals_get(void);
|
||||
void mp_locals_set(mp_obj_dict_t *d);
|
||||
|
Loading…
Reference in New Issue
Block a user