From 479b28660006a0e4f2febb67a0bd8e517290cd78 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Sun, 20 Jan 2019 17:32:43 -0800 Subject: [PATCH] Fix dict_make_new --- py/objdict.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/py/objdict.c b/py/objdict.c index f672ac039e..683fcb748e 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -91,7 +91,10 @@ STATIC mp_obj_t dict_make_new(const mp_obj_type_t *type, size_t n_args, const mp } #endif if (n_args > 0 || kw_args != NULL) { - mp_obj_t args2[2] = {dict_out, args[0]}; // args[0] is always valid, even if it's not a positional arg + mp_obj_t args2[2] = {dict_out, NULL}; // args[0] is always valid, even if it's not a positional arg + if (n_args > 0) { + args2[1] = args[0]; + } dict_update(n_args + 1, args2, kw_args); // dict_update will check that n_args + 1 == 1 or 2 } return dict_out;