py: De-optimise some uses of mp_getiter, so they don't use the C stack.

In these cases the heap is anyway used to create a new object so no real
need to use the C stack for iterating.  It saves a few bytes of code size.
This commit is contained in:
Damien George
2017-02-13 15:44:31 +11:00
parent 019048a6dc
commit e6003f466e
6 changed files with 13 additions and 26 deletions

View File

@@ -60,8 +60,7 @@ STATIC void list_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t k
}
STATIC mp_obj_t list_extend_from_iter(mp_obj_t list, mp_obj_t iterable) {
mp_obj_iter_buf_t iter_buf;
mp_obj_t iter = mp_getiter(iterable, &iter_buf);
mp_obj_t iter = mp_getiter(iterable, NULL);
mp_obj_t item;
while ((item = mp_iternext(iter)) != MP_OBJ_STOP_ITERATION) {
mp_obj_list_append(list, item);