Browse Source

mp_obj_new_list(n, items): Copy items only if not-NULL.

Similar to mp_obj_new_tuple().
pull/262/head
Paul Sokolovsky 11 years ago
parent
commit
e5a15cb7a5
  1. 6
      py/objlist.c

6
py/objlist.c

@ -435,8 +435,10 @@ static mp_obj_list_t *list_new(uint n) {
mp_obj_t mp_obj_new_list(uint n, mp_obj_t *items) {
mp_obj_list_t *o = list_new(n);
for (int i = 0; i < n; i++) {
o->items[i] = items[i];
if (items != NULL) {
for (int i = 0; i < n; i++) {
o->items[i] = items[i];
}
}
return o;
}

Loading…
Cancel
Save