File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,12 +128,12 @@ static mp_obj_t dict_clear(mp_obj_t self_in) {
128128
129129 return mp_const_none ;
130130}
131+ static MP_DEFINE_CONST_FUN_OBJ_1 (dict_clear_obj , dict_clear ) ;
132+
131133
132134/******************************************************************************/
133135/* dict constructors & etc */
134136
135- static MP_DEFINE_CONST_FUN_OBJ_1 (dict_clear_obj , dict_clear ) ;
136-
137137const mp_obj_type_t dict_type = {
138138 { & mp_const_type },
139139 "dict" ,
@@ -156,13 +156,7 @@ mp_obj_t mp_obj_new_dict(int n_args) {
156156
157157uint mp_obj_dict_len (mp_obj_t self_in ) {
158158 mp_obj_dict_t * self = self_in ;
159- uint len = 0 ;
160- for (int i = 0 ; i < self -> map .alloc ; i ++ ) {
161- if (self -> map .table [i ].key != NULL ) {
162- len += 1 ;
163- }
164- }
165- return len ;
159+ return self -> map .used ;
166160}
167161
168162mp_obj_t mp_obj_dict_store (mp_obj_t self_in , mp_obj_t key , mp_obj_t value ) {
You can’t perform that action at this time.
0 commit comments