@@ -2761,7 +2761,7 @@ STATIC void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) {
27612761
27622762 // first element sets whether it's a dict or set
27632763 bool is_dict ;
2764- if (MP_PARSE_NODE_IS_STRUCT_KIND (pns -> nodes [0 ], PN_dictorsetmaker_item )) {
2764+ if (! MICROPY_PY_BUILTINS_SET || MP_PARSE_NODE_IS_STRUCT_KIND (pns -> nodes [0 ], PN_dictorsetmaker_item )) {
27652765 // a dictionary
27662766 EMIT_ARG (build_map , 1 + n );
27672767 compile_node (comp , pns -> nodes [0 ]);
@@ -2792,13 +2792,15 @@ STATIC void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) {
27922792 }
27932793 }
27942794
2795+ #if MICROPY_PY_BUILTINS_SET
27952796 // if it's a set, build it
27962797 if (!is_dict ) {
27972798 EMIT_ARG (build_set , 1 + n );
27982799 }
2800+ #endif
27992801 } else if (MP_PARSE_NODE_STRUCT_KIND (pns1 ) == PN_comp_for ) {
28002802 // dict/set comprehension
2801- if (MP_PARSE_NODE_IS_STRUCT_KIND (pns -> nodes [0 ], PN_dictorsetmaker_item )) {
2803+ if (! MICROPY_PY_BUILTINS_SET || MP_PARSE_NODE_IS_STRUCT_KIND (pns -> nodes [0 ], PN_dictorsetmaker_item )) {
28022804 // a dictionary comprehension
28032805 compile_comprehension (comp , pns , SCOPE_DICT_COMP );
28042806 } else {
@@ -2816,8 +2818,12 @@ STATIC void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) {
28162818 } else {
28172819 // set with one element
28182820 set_with_one_element :
2821+ #if MICROPY_PY_BUILTINS_SET
28192822 compile_node (comp , pn );
28202823 EMIT_ARG (build_set , 1 );
2824+ #else
2825+ assert (0 );
2826+ #endif
28212827 }
28222828}
28232829
@@ -3111,8 +3117,10 @@ STATIC void compile_scope_comp_iter(compiler_t *comp, mp_parse_node_t pn_iter, m
31113117 EMIT_ARG (list_append , for_depth + 2 );
31123118 } else if (comp -> scope_cur -> kind == SCOPE_DICT_COMP ) {
31133119 EMIT_ARG (map_add , for_depth + 2 );
3120+ #if MICROPY_PY_BUILTINS_SET
31143121 } else if (comp -> scope_cur -> kind == SCOPE_SET_COMP ) {
31153122 EMIT_ARG (set_add , for_depth + 2 );
3123+ #endif
31163124 } else {
31173125 EMIT (yield_value );
31183126 EMIT (pop_top );
@@ -3305,8 +3313,10 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
33053313 EMIT_ARG (build_list , 0 );
33063314 } else if (scope -> kind == SCOPE_DICT_COMP ) {
33073315 EMIT_ARG (build_map , 0 );
3316+ #if MICROPY_PY_BUILTINS_SET
33083317 } else if (scope -> kind == SCOPE_SET_COMP ) {
33093318 EMIT_ARG (build_set , 0 );
3319+ #endif
33103320 }
33113321
33123322 uint l_end = comp_next_label (comp );
0 commit comments