py: Fix "TypeError: 'iterator' object is not iterable", doh.

This commit is contained in:
Paul Sokolovsky 2014-03-30 22:00:12 +03:00
parent f39d3b93da
commit f7eaf605c0
9 changed files with 18 additions and 0 deletions

View File

@ -219,6 +219,7 @@ STATIC mp_obj_t array_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t array_it_type = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.getiter = mp_identity,
.iternext = array_it_iternext,
};

View File

@ -107,6 +107,7 @@ mp_obj_t dict_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t mp_type_dict_it = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.getiter = mp_identity,
.iternext = dict_it_iternext,
};
@ -336,6 +337,7 @@ STATIC mp_obj_t dict_view_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t dict_view_it_type = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.getiter = mp_identity,
.iternext = dict_view_it_iternext,
};

View File

@ -38,6 +38,7 @@ STATIC mp_obj_t it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t it_type = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.getiter = mp_identity,
.iternext = it_iternext
};

View File

@ -408,6 +408,7 @@ 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,
};

View File

@ -63,6 +63,7 @@ STATIC mp_obj_t range_it_iternext(mp_obj_t o_in) {
STATIC const mp_obj_type_t range_it_type = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.getiter = mp_identity,
.iternext = range_it_iternext,
};

View File

@ -72,6 +72,7 @@ STATIC mp_obj_t set_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_
const mp_obj_type_t mp_type_set_it = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.getiter = mp_identity,
.iternext = set_it_iternext,
};

View File

@ -885,6 +885,7 @@ STATIC mp_obj_t str_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t mp_type_str_it = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.getiter = mp_identity,
.iternext = str_it_iternext,
};
@ -903,6 +904,7 @@ STATIC mp_obj_t bytes_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t mp_type_bytes_it = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.getiter = mp_identity,
.iternext = bytes_it_iternext,
};

View File

@ -251,6 +251,7 @@ STATIC mp_obj_t tuple_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t mp_type_tuple_it = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.getiter = mp_identity,
.iternext = tuple_it_iternext,
};

View File

@ -0,0 +1,8 @@
i = iter(iter((1, 2, 3)))
print(list(i))
i = iter(iter([1, 2, 3]))
print(list(i))
i = iter(iter({1:2, 3:4, 5:6}))
print(list(i))
i = iter(iter({1, 2, 3}))
print(list(i))