Skip to content

Commit 76101c0

Browse files
committed
core: Allow enum types to specify additional fields in the object
this will be used to make MathOperation enum values callable to construct a Math object with that function
1 parent 4ff08e0 commit 76101c0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

py/enum.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ typedef struct {
5050
cp_enum_obj_print_helper(MP_QSTR_##module, print, self_in, kind); \
5151
}
5252

53-
#define MAKE_ENUM_TYPE(module, type, typename) \
53+
#define MAKE_ENUM_TYPE(module, type, typename, ...) \
5454
const mp_obj_type_t typename##_type = { \
5555
{ &mp_type_type }, \
5656
.name = MP_QSTR_##type, \
5757
.print = typename##_print, \
5858
.locals_dict = (mp_obj_dict_t *)&typename##_locals_dict, \
59+
##__VA_ARGS__ \
5960
}
6061

6162

0 commit comments

Comments
 (0)