diff options
Diffstat (limited to 'py/objlist.c')
-rw-r--r-- | py/objlist.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/py/objlist.c b/py/objlist.c index a4bec9e320..d0641f21c2 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -498,6 +498,7 @@ void mp_obj_list_store(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { typedef struct _mp_obj_list_it_t { mp_obj_base_t base; + mp_fun_1_t iternext; mp_obj_t list; mp_uint_t cur; } mp_obj_list_it_t; @@ -514,16 +515,10 @@ STATIC mp_obj_t list_it_iternext(mp_obj_t self_in) { } } -STATIC const mp_obj_type_t mp_type_list_it = { - { &mp_type_type }, - .name = MP_QSTR_iterator, - .getiter = mp_identity, - .iternext = list_it_iternext, -}; - mp_obj_t mp_obj_new_list_iterator(mp_obj_t list, mp_uint_t cur) { mp_obj_list_it_t *o = m_new_obj(mp_obj_list_it_t); - o->base.type = &mp_type_list_it; + o->base.type = &mp_type_polymorph_iter; + o->iternext = list_it_iternext; o->list = list; o->cur = cur; return MP_OBJ_FROM_PTR(o); |