Skip to content

Commit 9fdecac

Browse files
authored
Merge pull request #4903 from jepler/split-type-objects
Split type objects
2 parents 4b371a8 + 6d0ed1a commit 9fdecac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+908
-433
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ TRANSLATE_SOURCES_EXC = -path "ports/*/build-*" \
5454
-o -path ports/stm/st_driver \
5555
-o -path lib/tinyusb \
5656
-o -path lib/lwip \
57+
-o -path extmod/ulab/circuitpython \
58+
-o -path extmod/ulab/micropython \
5759

5860
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext stubs
5961

extmod/modbtree.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,16 @@ STATIC MP_DEFINE_CONST_DICT(btree_locals_dict, btree_locals_dict_table);
295295
STATIC const mp_obj_type_t btree_type = {
296296
{ &mp_type_type },
297297
// Save on qstr's, reuse same as for module
298+
.flags = MP_TYPE_FLAG_EXTENDED,
298299
.name = MP_QSTR_btree,
299300
.print = btree_print,
300-
.getiter = btree_getiter,
301-
.iternext = btree_iternext,
302-
.binary_op = btree_binary_op,
303-
.subscr = btree_subscr,
304301
.locals_dict = (void *)&btree_locals_dict,
302+
MP_TYPE_EXTENDED_FIELDS(
303+
.getiter = btree_getiter,
304+
.iternext = btree_iternext,
305+
.binary_op = btree_binary_op,
306+
.subscr = btree_subscr,
307+
),
305308
};
306309
#endif
307310

extmod/modframebuf.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,10 +602,13 @@ STATIC MP_DEFINE_CONST_DICT(framebuf_locals_dict, framebuf_locals_dict_table);
602602

603603
STATIC const mp_obj_type_t mp_type_framebuf = {
604604
{ &mp_type_type },
605+
.flags = MP_TYPE_FLAG_EXTENDED,
605606
.name = MP_QSTR_FrameBuffer,
606607
.make_new = framebuf_make_new,
607-
.buffer_p = { .get_buffer = framebuf_get_buffer },
608608
.locals_dict = (mp_obj_dict_t *)&framebuf_locals_dict,
609+
MP_TYPE_EXTENDED_FIELDS(
610+
.buffer_p = { .get_buffer = framebuf_get_buffer },
611+
),
609612
};
610613
#endif
611614

extmod/moduasyncio.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,14 @@ STATIC mp_obj_t task_iternext(mp_obj_t self_in) {
284284

285285
STATIC const mp_obj_type_t task_type = {
286286
{ &mp_type_type },
287+
.flags = MP_TYPE_FLAG_EXTENDED,
287288
.name = MP_QSTR_Task,
288289
.make_new = task_make_new,
289290
.attr = task_attr,
290-
.getiter = task_getiter,
291-
.iternext = task_iternext,
291+
MP_TYPE_EXTENDED_FIELDS(
292+
.getiter = task_getiter,
293+
.iternext = task_iternext,
294+
),
292295
};
293296

294297
/******************************************************************************/

extmod/moductypes.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,13 +622,16 @@ MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytes_at_obj, uctypes_struct_bytes_at);
622622

623623
STATIC const mp_obj_type_t uctypes_struct_type = {
624624
{ &mp_type_type },
625+
.flags = MP_TYPE_FLAG_EXTENDED,
625626
.name = MP_QSTR_struct,
626627
.print = uctypes_struct_print,
627628
.make_new = uctypes_struct_make_new,
628629
.attr = uctypes_struct_attr,
629-
.subscr = uctypes_struct_subscr,
630-
.unary_op = uctypes_struct_unary_op,
631-
.buffer_p = { .get_buffer = uctypes_get_buffer },
630+
MP_TYPE_EXTENDED_FIELDS(
631+
.subscr = uctypes_struct_subscr,
632+
.unary_op = uctypes_struct_unary_op,
633+
.buffer_p = { .get_buffer = uctypes_get_buffer },
634+
),
632635
};
633636

634637
STATIC const mp_rom_map_elem_t mp_module_uctypes_globals_table[] = {

extmod/modutimeq.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,13 @@ STATIC MP_DEFINE_CONST_DICT(utimeq_locals_dict, utimeq_locals_dict_table);
193193

194194
STATIC const mp_obj_type_t utimeq_type = {
195195
{ &mp_type_type },
196+
.flags = MP_TYPE_FLAG_EXTENDED,
196197
.name = MP_QSTR_utimeq,
197198
.make_new = utimeq_make_new,
198-
.unary_op = utimeq_unary_op,
199199
.locals_dict = (void *)&utimeq_locals_dict,
200+
MP_TYPE_EXTENDED_FIELDS(
201+
.unary_op = utimeq_unary_op,
202+
),
200203
};
201204

202205
STATIC const mp_rom_map_elem_t mp_module_utimeq_globals_table[] = {

extmod/moduzlib.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,13 @@ STATIC const mp_stream_p_t decompio_stream_p = {
122122
#if !MICROPY_ENABLE_DYNRUNTIME
123123
STATIC const mp_obj_type_t decompio_type = {
124124
{ &mp_type_type },
125+
.flags = MP_TYPE_FLAG_EXTENDED,
125126
.name = MP_QSTR_DecompIO,
126127
.make_new = decompio_make_new,
127-
.protocol = &decompio_stream_p,
128128
.locals_dict = (void *)&decompio_locals_dict,
129+
MP_TYPE_EXTENDED_FIELDS(
130+
.protocol = &decompio_stream_p,
131+
),
129132
};
130133
#endif
131134

extmod/vfs_fat.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,13 @@ STATIC const mp_vfs_proto_t fat_vfs_proto = {
474474

475475
const mp_obj_type_t mp_fat_vfs_type = {
476476
{ &mp_type_type },
477+
.flags = MP_TYPE_FLAG_EXTENDED,
477478
.name = MP_QSTR_VfsFat,
478479
.make_new = fat_vfs_make_new,
479-
.protocol = &fat_vfs_proto,
480480
.locals_dict = (mp_obj_dict_t *)&fat_vfs_locals_dict,
481+
MP_TYPE_EXTENDED_FIELDS(
482+
.protocol = &fat_vfs_proto,
483+
),
481484

482485
};
483486

extmod/vfs_fat_file.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,16 @@ STATIC const mp_stream_p_t vfs_fat_fileio_stream_p = {
244244

245245
const mp_obj_type_t mp_type_vfs_fat_fileio = {
246246
{ &mp_type_type },
247+
.flags = MP_TYPE_FLAG_EXTENDED,
247248
.name = MP_QSTR_FileIO,
248249
.print = file_obj_print,
249250
.make_new = file_obj_make_new,
250-
.getiter = mp_identity_getiter,
251-
.iternext = mp_stream_unbuffered_iter,
252-
.protocol = &vfs_fat_fileio_stream_p,
253251
.locals_dict = (mp_obj_dict_t *)&vfs_fat_rawfile_locals_dict,
252+
MP_TYPE_EXTENDED_FIELDS(
253+
.getiter = mp_identity_getiter,
254+
.iternext = mp_stream_unbuffered_iter,
255+
.protocol = &vfs_fat_fileio_stream_p,
256+
),
254257
};
255258
#endif
256259

@@ -264,13 +267,16 @@ STATIC const mp_stream_p_t vfs_fat_textio_stream_p = {
264267

265268
const mp_obj_type_t mp_type_vfs_fat_textio = {
266269
{ &mp_type_type },
270+
.flags = MP_TYPE_FLAG_EXTENDED,
267271
.name = MP_QSTR_TextIOWrapper,
268272
.print = file_obj_print,
269273
.make_new = file_obj_make_new,
270-
.getiter = mp_identity_getiter,
271-
.iternext = mp_stream_unbuffered_iter,
272-
.protocol = &vfs_fat_textio_stream_p,
273274
.locals_dict = (mp_obj_dict_t *)&vfs_fat_rawfile_locals_dict,
275+
MP_TYPE_EXTENDED_FIELDS(
276+
.getiter = mp_identity_getiter,
277+
.iternext = mp_stream_unbuffered_iter,
278+
.protocol = &vfs_fat_textio_stream_p,
279+
),
274280
};
275281

276282
// Factory function for I/O stream classes

0 commit comments

Comments
 (0)