summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-01-20 17:32:43 -0800
committerScott Shawcroft <scott@tannewt.org>2019-01-20 17:32:43 -0800
commit479b28660006a0e4f2febb67a0bd8e517290cd78 (patch)
tree4b77aaa03617b5e31d607fcef246998e3c916b08 /py
parent5ddc50473a37959fcac5a768013c825b1b1d8d23 (diff)
Fix dict_make_new
Diffstat (limited to 'py')
-rw-r--r--py/objdict.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/py/objdict.c b/py/objdict.c
index f672ac039..683fcb748 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;