Check for null kw_args

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

View File

@ -96,7 +96,10 @@ void namedtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
const mp_obj_namedtuple_type_t *type = (const mp_obj_namedtuple_type_t*)type_in;
size_t num_fields = type->n_fields;
size_t n_kw = kw_args->used;
size_t n_kw = 0;
if (kw_args != NULL) {
n_kw = kw_args->used;
}
if (n_args + n_kw != num_fields) {
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
mp_arg_error_terse_mismatch();