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

@@ -141,8 +141,7 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
mp_obj_array_t *array = array_new(typecode, len);
mp_obj_iter_buf_t iter_buf;
mp_obj_t iterable = mp_getiter(initializer, &iter_buf);
mp_obj_t iterable = mp_getiter(initializer, NULL);
mp_obj_t item;
size_t i = 0;
while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {