@@ -102,7 +102,6 @@ static const mp_obj_type_t dict_it_type = {
102102 { & mp_const_type },
103103 "dict_iterator" ,
104104 .iternext = dict_it_iternext ,
105- .methods = { { NULL , NULL }, },
106105};
107106
108107static mp_obj_t mp_obj_new_dict_iterator (mp_obj_dict_t * dict , int cur ) {
@@ -250,23 +249,25 @@ static MP_DEFINE_CONST_FUN_OBJ_2(dict_update_obj, dict_update);
250249/******************************************************************************/
251250/* dict constructors & etc */
252251
252+ static const mp_method_t dict_type_methods [] = {
253+ { "clear" , & dict_clear_obj },
254+ { "copy" , & dict_copy_obj },
255+ { "get" , & dict_get_obj },
256+ { "pop" , & dict_pop_obj },
257+ { "popitem" , & dict_popitem_obj },
258+ { "setdefault" , & dict_setdefault_obj },
259+ { "update" , & dict_update_obj },
260+ { NULL , NULL }, // end-of-list sentinel
261+ };
262+
253263const mp_obj_type_t dict_type = {
254264 { & mp_const_type },
255265 "dict" ,
256266 .print = dict_print ,
257267 .make_new = dict_make_new ,
258268 .binary_op = dict_binary_op ,
259269 .getiter = dict_getiter ,
260- .methods = {
261- { "clear" , & dict_clear_obj },
262- { "copy" , & dict_copy_obj },
263- { "get" , & dict_get_obj },
264- { "pop" , & dict_pop_obj },
265- { "popitem" , & dict_popitem_obj },
266- { "setdefault" , & dict_setdefault_obj },
267- { "update" , & dict_update_obj },
268- { NULL , NULL }, // end-of-list sentinel
269- },
270+ .methods = dict_type_methods ,
270271};
271272
272273mp_obj_t mp_obj_new_dict (int n_args ) {
0 commit comments