diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-14 15:13:40 -0800 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-14 15:13:40 -0800 |
commit | 6c2401e935b38ca87fd8f52efbb614a428b6938c (patch) | |
tree | 9314200eddfd45d99491cb29f47533404ef030f5 /py/objlist.c | |
parent | 8bc96471f0219b9d3f24ae879f60b509927e1df4 (diff) | |
parent | 93451002f04e0b89e41e1faa82f86e937bb219f1 (diff) | |
download | micropython-6c2401e935b38ca87fd8f52efbb614a428b6938c.tar.gz micropython-6c2401e935b38ca87fd8f52efbb614a428b6938c.zip |
Merge pull request #165 from chipaca/builtins
added zip()
Diffstat (limited to 'py/objlist.c')
-rw-r--r-- | py/objlist.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/py/objlist.c b/py/objlist.c index fa8ec67d09..f806dfae8f 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -248,13 +248,14 @@ static void mp_quicksort(mp_obj_t *head, mp_obj_t *tail, mp_obj_t key_fn, bool r } } -static mp_obj_t list_sort(mp_obj_t args, mp_map_t *kwargs) { +mp_obj_t list_sort(mp_obj_t args, mp_map_t *kwargs) { mp_obj_t *args_items = NULL; uint args_len = 0; assert(MP_OBJ_IS_TYPE(args, &tuple_type)); mp_obj_tuple_get(args, &args_len, &args_items); assert(args_len >= 1); + assert(MP_OBJ_IS_TYPE(args_items[0], &list_type)); if (args_len > 1) { nlr_jump(mp_obj_new_exception_msg(MP_QSTR_TypeError, "list.sort takes no positional arguments")); @@ -380,7 +381,7 @@ static MP_DEFINE_CONST_FUN_OBJ_3(list_insert_obj, list_insert); static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(list_pop_obj, 1, 2, list_pop); static MP_DEFINE_CONST_FUN_OBJ_2(list_remove_obj, list_remove); static MP_DEFINE_CONST_FUN_OBJ_1(list_reverse_obj, list_reverse); -static MP_DEFINE_CONST_FUN_OBJ_KW(list_sort_obj, list_sort); +static MP_DEFINE_CONST_FUN_OBJ_KW(list_sort_obj, 0, list_sort); static const mp_method_t list_type_methods[] = { { "append", &list_append_obj }, |