From 4ebbacd65eec4c0fde8ceb32274c06f5e3de3af6 Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing Date: Sun, 8 Dec 2019 21:43:47 +0100 Subject: [PATCH] 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. --- py/objenumerate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/objenumerate.c b/py/objenumerate.c index 493e45c2a2..243c9f83aa 100644 --- a/py/objenumerate.c +++ b/py/objenumerate.c @@ -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);