py/objenumerate: Check for valid args in enumerate constructor.

For the case where MICROPY_CPYTHON_COMPAT is disabled.  This fix makes
basics/fun_error2.py pass and not crash the interpreter.
This commit is contained in:
Emil Renner Berthing 2019-12-08 21:43:47 +01:00 committed by Damien George
parent 193bc3702f
commit 4ebbacd65e
1 changed files with 1 additions and 1 deletions

View File

@ -59,7 +59,7 @@ STATIC mp_obj_t enumerate_make_new(const mp_obj_type_t *type, size_t n_args, siz
o->iter = mp_getiter(arg_vals.iterable.u_obj, NULL);
o->cur = arg_vals.start.u_int;
#else
(void)n_kw;
mp_arg_check_num(n_args, n_kw, 1, 2, false);
mp_obj_enumerate_t *o = m_new_obj(mp_obj_enumerate_t);
o->base.type = type;
o->iter = mp_getiter(args[0], NULL);