3131#include "misc.h"
3232#include "qstr.h"
3333#include "obj.h"
34+ #include "objtuple.h"
3435#include "runtime.h"
3536
3637typedef struct _mp_obj_zip_t {
3738 mp_obj_base_t base ;
38- int n_iters ;
39+ mp_uint_t n_iters ;
3940 mp_obj_t iters [];
4041} mp_obj_zip_t ;
4142
@@ -45,7 +46,7 @@ STATIC mp_obj_t zip_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw,
4546 mp_obj_zip_t * o = m_new_obj_var (mp_obj_zip_t , mp_obj_t , n_args );
4647 o -> base .type = & mp_type_zip ;
4748 o -> n_iters = n_args ;
48- for (int i = 0 ; i < n_args ; i ++ ) {
49+ for (mp_uint_t i = 0 ; i < n_args ; i ++ ) {
4950 o -> iters [i ] = mp_getiter (args [i ]);
5051 }
5152 return o ;
@@ -54,22 +55,20 @@ STATIC mp_obj_t zip_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw,
5455STATIC mp_obj_t zip_iternext (mp_obj_t self_in ) {
5556 assert (MP_OBJ_IS_TYPE (self_in , & mp_type_zip ));
5657 mp_obj_zip_t * self = self_in ;
57- mp_obj_t * items ;
5858 if (self -> n_iters == 0 ) {
5959 return MP_OBJ_STOP_ITERATION ;
6060 }
61- mp_obj_t o = mp_obj_new_tuple (self -> n_iters , NULL );
62- mp_obj_tuple_get (o , NULL , & items );
61+ mp_obj_tuple_t * tuple = mp_obj_new_tuple (self -> n_iters , NULL );
6362
64- for (int i = 0 ; i < self -> n_iters ; i ++ ) {
63+ for (mp_uint_t i = 0 ; i < self -> n_iters ; i ++ ) {
6564 mp_obj_t next = mp_iternext (self -> iters [i ]);
6665 if (next == MP_OBJ_STOP_ITERATION ) {
67- mp_obj_tuple_del (o );
66+ mp_obj_tuple_del (tuple );
6867 return MP_OBJ_STOP_ITERATION ;
6968 }
70- items [i ] = next ;
69+ tuple -> items [i ] = next ;
7170 }
72- return o ;
71+ return tuple ;
7372}
7473
7574const mp_obj_type_t mp_type_zip = {
0 commit comments