Fix dict_make_new

This commit is contained in:
Scott Shawcroft 2019-01-20 17:32:43 -08:00
parent 5ddc50473a
commit 479b286600
No known key found for this signature in database
GPG Key ID: FD0EDC4B6C53CA59
1 changed files with 4 additions and 1 deletions

View File

@ -91,7 +91,10 @@ STATIC mp_obj_t dict_make_new(const mp_obj_type_t *type, size_t n_args, const mp
} }
#endif #endif
if (n_args > 0 || kw_args != NULL) { 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 dict_update(n_args + 1, args2, kw_args); // dict_update will check that n_args + 1 == 1 or 2
} }
return dict_out; return dict_out;