Skip to content

Commit 94beeab

Browse files
jimmodpgeorge
authored andcommitted
py/obj: Convert make_new into a mp_obj_type_t slot.
Instead of being an explicit field, it's now a slot like all the other methods. This is a marginal code size improvement because most types have a make_new (100/138 on PYBV11), however it improves consistency in how types are declared, removing the special case for make_new. Signed-off-by: Jim Mussared <[email protected]>
1 parent 6da41b5 commit 94beeab

File tree

248 files changed

+316
-397
lines changed

Some content is hidden

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

248 files changed

+316
-397
lines changed

drivers/ninaw10/nina_wifi_bsp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int nina_bsp_init(void) {
7373
MP_OBJ_NEW_SMALL_INT(MICROPY_HW_WIFI_SPI_BAUDRATE),
7474
};
7575

76-
MP_STATE_PORT(mp_wifi_spi) = machine_spi_type.make_new((mp_obj_t)&machine_spi_type, 2, 0, args);
76+
MP_STATE_PORT(mp_wifi_spi) = MP_OBJ_TYPE_GET_SLOT(&machine_spi_type, make_new)((mp_obj_t)&machine_spi_type, 2, 0, args);
7777
return 0;
7878
}
7979

examples/natmod/framebuf/framebuf.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *a
2020

2121
mp_type_framebuf.base.type = (void*)&mp_type_type;
2222
mp_type_framebuf.name = MP_QSTR_FrameBuffer;
23-
mp_type_framebuf.make_new = framebuf_make_new;
24-
MP_OBJ_TYPE_SET_SLOT(&mp_type_framebuf, buffer, framebuf_get_buffer, 0);
23+
MP_OBJ_TYPE_SET_SLOT(&mp_type_framebuf, make_new, framebuf_make_new, 0);
24+
MP_OBJ_TYPE_SET_SLOT(&mp_type_framebuf, buffer, framebuf_get_buffer, 1);
2525
framebuf_locals_dict_table[0] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_fill), MP_OBJ_FROM_PTR(&framebuf_fill_obj) };
2626
framebuf_locals_dict_table[1] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_fill_rect), MP_OBJ_FROM_PTR(&framebuf_fill_rect_obj) };
2727
framebuf_locals_dict_table[2] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_pixel), MP_OBJ_FROM_PTR(&framebuf_pixel_obj) };
@@ -33,7 +33,7 @@ mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *a
3333
framebuf_locals_dict_table[8] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_blit), MP_OBJ_FROM_PTR(&framebuf_blit_obj) };
3434
framebuf_locals_dict_table[9] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_scroll), MP_OBJ_FROM_PTR(&framebuf_scroll_obj) };
3535
framebuf_locals_dict_table[10] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_text), MP_OBJ_FROM_PTR(&framebuf_text_obj) };
36-
MP_OBJ_TYPE_SET_SLOT(&mp_type_framebuf, locals_dict, (void*)&framebuf_locals_dict, 1);
36+
MP_OBJ_TYPE_SET_SLOT(&mp_type_framebuf, locals_dict, (void*)&framebuf_locals_dict, 2);
3737

3838
mp_store_global(MP_QSTR_FrameBuffer, MP_OBJ_FROM_PTR(&mp_type_framebuf));
3939
mp_store_global(MP_QSTR_FrameBuffer1, MP_OBJ_FROM_PTR(&legacy_framebuffer1_obj));

examples/natmod/uzlib/uzlib.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *a
2020

2121
decompio_type.base.type = mp_fun_table.type_type;
2222
decompio_type.name = MP_QSTR_DecompIO;
23-
decompio_type.make_new = &decompio_make_new;
24-
MP_OBJ_TYPE_SET_SLOT(&decompio_type, protocol, &decompio_stream_p, 0);
23+
MP_OBJ_TYPE_SET_SLOT(&decompio_type, make_new, &decompio_make_new, 0);
24+
MP_OBJ_TYPE_SET_SLOT(&decompio_type, protocol, &decompio_stream_p, 1);
2525
decompio_locals_dict_table[0] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_read), MP_OBJ_FROM_PTR(&mp_stream_read_obj) };
2626
decompio_locals_dict_table[1] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_readinto), MP_OBJ_FROM_PTR(&mp_stream_readinto_obj) };
2727
decompio_locals_dict_table[2] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_readline), MP_OBJ_FROM_PTR(&mp_stream_unbuffered_readline_obj) };
28-
MP_OBJ_TYPE_SET_SLOT(&decompio_type, locals_dict, (void*)&decompio_locals_dict, 1);
28+
MP_OBJ_TYPE_SET_SLOT(&decompio_type, locals_dict, (void*)&decompio_locals_dict, 2);
2929

3030
mp_store_global(MP_QSTR___name__, MP_OBJ_NEW_QSTR(MP_QSTR_uzlib));
3131
mp_store_global(MP_QSTR_decompress, MP_OBJ_FROM_PTR(&mod_uzlib_decompress_obj));

extmod/machine_i2c.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
734734
mp_machine_soft_i2c_type,
735735
MP_QSTR_SoftI2C,
736736
MP_TYPE_FLAG_NONE,
737-
mp_machine_soft_i2c_make_new,
737+
make_new, mp_machine_soft_i2c_make_new,
738738
print, mp_machine_soft_i2c_print,
739739
protocol, &mp_machine_soft_i2c_p,
740740
locals_dict, &mp_machine_i2c_locals_dict

extmod/machine_i2c.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
--n_args; \
3939
++all_args; \
4040
} \
41-
return mp_machine_soft_i2c_type.make_new(&mp_machine_soft_i2c_type, n_args, n_kw, all_args); \
41+
return MP_OBJ_TYPE_GET_SLOT(&mp_machine_soft_i2c_type, make_new)(&mp_machine_soft_i2c_type, n_args, n_kw, all_args); \
4242
} \
4343
} while (0)
4444

extmod/machine_mem.c

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
105105
machine_mem_type,
106106
MP_QSTR_mem,
107107
MP_TYPE_FLAG_NONE,
108-
MP_TYPE_NULL_MAKE_NEW,
109108
print, machine_mem_print,
110109
subscr, machine_mem_subscr
111110
);

extmod/machine_pinbase.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
8181
machine_pinbase_type,
8282
MP_QSTR_PinBase,
8383
MP_TYPE_FLAG_NONE,
84-
pinbase_make_new,
84+
make_new, pinbase_make_new,
8585
protocol, &pinbase_pin_p
8686
);
8787

extmod/machine_pwm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
136136
machine_pwm_type,
137137
MP_QSTR_PWM,
138138
MP_TYPE_FLAG_NONE,
139-
mp_machine_pwm_make_new,
139+
make_new, mp_machine_pwm_make_new,
140140
print, mp_machine_pwm_print,
141141
locals_dict, &machine_pwm_locals_dict
142142
);

extmod/machine_signal.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
176176
machine_signal_type,
177177
MP_QSTR_Signal,
178178
MP_TYPE_FLAG_NONE,
179-
signal_make_new,
179+
make_new, signal_make_new,
180180
call, signal_call,
181181
protocol, &signal_pin_p,
182182
locals_dict, &signal_locals_dict

extmod/machine_spi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
255255
mp_machine_soft_spi_type,
256256
MP_QSTR_SoftSPI,
257257
MP_TYPE_FLAG_NONE,
258-
mp_machine_soft_spi_make_new,
258+
make_new, mp_machine_soft_spi_make_new,
259259
print, mp_machine_soft_spi_print,
260260
protocol, &mp_machine_soft_spi_p,
261261
locals_dict, &mp_machine_spi_locals_dict

extmod/machine_spi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
--n_args; \
4040
++all_args; \
4141
} \
42-
return mp_machine_soft_spi_type.make_new(&mp_machine_soft_spi_type, n_args, n_kw, all_args); \
42+
return MP_OBJ_TYPE_GET_SLOT(&mp_machine_soft_spi_type, make_new)(&mp_machine_soft_spi_type, n_args, n_kw, all_args); \
4343
} \
4444
} while (0)
4545

extmod/modbluetooth.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
244244
mp_type_bluetooth_uuid,
245245
MP_QSTR_UUID,
246246
MP_TYPE_FLAG_NONE,
247-
bluetooth_uuid_make_new,
247+
make_new, bluetooth_uuid_make_new,
248248
unary_op, bluetooth_uuid_unary_op,
249249
binary_op, bluetooth_uuid_binary_op,
250250
print, bluetooth_uuid_print,
@@ -980,7 +980,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
980980
mp_type_bluetooth_ble,
981981
MP_QSTR_BLE,
982982
MP_TYPE_FLAG_NONE,
983-
bluetooth_ble_make_new,
983+
make_new, bluetooth_ble_make_new,
984984
locals_dict, &bluetooth_ble_locals_dict
985985
);
986986

extmod/modbtree.c

-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
328328
btree_type,
329329
MP_QSTR_btree,
330330
MP_TYPE_FLAG_ITER_IS_CUSTOM,
331-
MP_TYPE_NULL_MAKE_NEW,
332331
// Save on qstr's, reuse same as for module
333332
print, btree_print,
334333
iter, &btree_getiter_iternext,

extmod/modframebuf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
833833
mp_type_framebuf,
834834
MP_QSTR_FrameBuffer,
835835
MP_TYPE_FLAG_NONE,
836-
framebuf_make_new,
836+
make_new, framebuf_make_new,
837837
buffer, framebuf_get_buffer,
838838
locals_dict, &framebuf_locals_dict
839839
);

extmod/modlwip.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
181181
lwip_slip_type,
182182
MP_QSTR_slip,
183183
MP_TYPE_FLAG_NONE,
184-
lwip_slip_make_new,
184+
make_new, lwip_slip_make_new,
185185
locals_dict, &lwip_slip_locals_dict
186186
);
187187

@@ -1599,7 +1599,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
15991599
lwip_socket_type,
16001600
MP_QSTR_socket,
16011601
MP_TYPE_FLAG_NONE,
1602-
lwip_socket_make_new,
1602+
make_new, lwip_socket_make_new,
16031603
print, lwip_socket_print,
16041604
protocol, &lwip_socket_stream_p,
16051605
locals_dict, &lwip_socket_locals_dict

extmod/moduasyncio.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
148148
task_queue_type,
149149
MP_QSTR_TaskQueue,
150150
MP_TYPE_FLAG_NONE,
151-
task_queue_make_new,
151+
make_new, task_queue_make_new,
152152
locals_dict, &task_queue_locals_dict
153153
);
154154

@@ -296,7 +296,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
296296
task_type,
297297
MP_QSTR_Task,
298298
MP_TYPE_FLAG_ITER_IS_CUSTOM,
299-
task_make_new,
299+
make_new, task_make_new,
300300
attr, task_attr,
301301
iter, &task_getiter_iternext
302302
);

extmod/moducryptolib.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
352352
ucryptolib_aes_type,
353353
MP_QSTR_aes,
354354
MP_TYPE_FLAG_NONE,
355-
ucryptolib_aes_make_new,
355+
make_new, ucryptolib_aes_make_new,
356356
locals_dict, &ucryptolib_aes_locals_dict
357357
);
358358

extmod/moductypes.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
638638
uctypes_struct_type,
639639
MP_QSTR_struct,
640640
MP_TYPE_FLAG_NONE,
641-
uctypes_struct_make_new,
641+
make_new, uctypes_struct_make_new,
642642
print, uctypes_struct_print,
643643
attr, uctypes_struct_attr,
644644
subscr, uctypes_struct_subscr,

extmod/moduhashlib.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
161161
uhashlib_sha256_type,
162162
MP_QSTR_sha256,
163163
MP_TYPE_FLAG_NONE,
164-
uhashlib_sha256_make_new,
164+
make_new, uhashlib_sha256_make_new,
165165
locals_dict, &uhashlib_sha256_locals_dict
166166
);
167167
#endif
@@ -255,7 +255,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
255255
uhashlib_sha1_type,
256256
MP_QSTR_sha1,
257257
MP_TYPE_FLAG_NONE,
258-
uhashlib_sha1_make_new,
258+
make_new, uhashlib_sha1_make_new,
259259
locals_dict, &uhashlib_sha1_locals_dict
260260
);
261261
#endif
@@ -349,7 +349,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
349349
uhashlib_md5_type,
350350
MP_QSTR_md5,
351351
MP_TYPE_FLAG_NONE,
352-
uhashlib_md5_make_new,
352+
make_new, uhashlib_md5_make_new,
353353
locals_dict, &uhashlib_md5_locals_dict
354354
);
355355
#endif // MICROPY_PY_UHASHLIB_MD5

extmod/modure.c

-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
183183
match_type,
184184
MP_QSTR_match,
185185
MP_TYPE_FLAG_NONE,
186-
MP_TYPE_NULL_MAKE_NEW,
187186
print, match_print,
188187
locals_dict, &match_locals_dict
189188
);
@@ -417,7 +416,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
417416
re_type,
418417
MP_QSTR_ure,
419418
MP_TYPE_FLAG_NONE,
420-
MP_TYPE_NULL_MAKE_NEW,
421419
print, re_print,
422420
locals_dict, &re_locals_dict
423421
);

extmod/moduselect.c

-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
340340
mp_type_poll,
341341
MP_QSTR_poll,
342342
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
343-
MP_TYPE_NULL_MAKE_NEW,
344343
iter, poll_iternext,
345344
locals_dict, &poll_locals_dict
346345
);

extmod/modusocket.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
532532
socket_type,
533533
MP_QSTR_socket,
534534
MP_TYPE_FLAG_NONE,
535-
socket_make_new,
535+
make_new, socket_make_new,
536536
protocol, &socket_stream_p,
537537
locals_dict, &socket_locals_dict,
538538
print, socket_print

extmod/modussl_axtls.c

-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
318318
ussl_socket_type,
319319
MP_QSTR_ussl,
320320
MP_TYPE_FLAG_NONE,
321-
MP_TYPE_NULL_MAKE_NEW,
322321
// Save on qstr's, reuse same as for module
323322
print, ussl_socket_print,
324323
protocol, &ussl_socket_stream_p,

extmod/modussl_mbedtls.c

-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
396396
ussl_socket_type,
397397
MP_QSTR_ussl,
398398
MP_TYPE_FLAG_NONE,
399-
MP_TYPE_NULL_MAKE_NEW,
400399
// Save on qstr's, reuse same as for module
401400
print, socket_print,
402401
protocol, &ussl_socket_stream_p,

extmod/modutimeq.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
213213
utimeq_type,
214214
MP_QSTR_utimeq,
215215
MP_TYPE_FLAG_NONE,
216-
utimeq_make_new,
216+
make_new, utimeq_make_new,
217217
unary_op, utimeq_unary_op,
218218
locals_dict, &utimeq_locals_dict
219219
);

extmod/moduwebsocket.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
294294
websocket_type,
295295
MP_QSTR_websocket,
296296
MP_TYPE_FLAG_NONE,
297-
websocket_make_new,
297+
make_new, websocket_make_new,
298298
protocol, &websocket_stream_p,
299299
locals_dict, &websocket_locals_dict
300300
);

extmod/moduzlib.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
144144
decompio_type,
145145
MP_QSTR_DecompIO,
146146
MP_TYPE_FLAG_NONE,
147-
decompio_make_new,
147+
make_new, decompio_make_new,
148148
protocol, &decompio_stream_p,
149149
locals_dict, &decompio_locals_dict
150150
);

extmod/modwebrepl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
346346
webrepl_type,
347347
MP_QSTR__webrepl,
348348
MP_TYPE_FLAG_NONE,
349-
webrepl_make_new,
349+
make_new, webrepl_make_new,
350350
protocol, &webrepl_stream_p,
351351
locals_dict, &webrepl_locals_dict
352352
);

extmod/network_cyw43.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
500500
mp_network_cyw43_type,
501501
MP_QSTR_CYW43,
502502
MP_TYPE_FLAG_NONE,
503-
network_cyw43_make_new,
503+
make_new, network_cyw43_make_new,
504504
print, network_cyw43_print,
505505
locals_dict, &network_cyw43_locals_dict
506506
);

extmod/network_ninaw10.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ STATIC mp_obj_t network_ninaw10_active(size_t n_args, const mp_obj_t *args) {
159159
MP_OBJ_NEW_QSTR(MP_QSTR_freq), MP_OBJ_NEW_SMALL_INT(10),
160160
MP_OBJ_NEW_QSTR(MP_QSTR_callback), MP_OBJ_FROM_PTR(&network_ninaw10_timer_callback_obj),
161161
};
162-
MP_STATE_PORT(mp_wifi_timer) = machine_timer_type.make_new((mp_obj_t)&machine_timer_type, 0, 2, timer_args);
162+
MP_STATE_PORT(mp_wifi_timer) = MP_OBJ_TYPE_GET_SLOT(&machine_timer_type, make_new)((mp_obj_t)&machine_timer_type, 0, 2, timer_args);
163163
}
164164
} else {
165165
nina_deinit();
@@ -778,7 +778,7 @@ STATIC MP_DEFINE_CONST_OBJ_FULL_TYPE(
778778
mod_network_nic_type_nina_base,
779779
MP_QSTR_nina,
780780
MP_TYPE_FLAG_NONE,
781-
network_ninaw10_make_new,
781+
make_new, network_ninaw10_make_new,
782782
locals_dict, &nina_locals_dict
783783
);
784784

extmod/network_wiznet5k.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size
708708
MP_ROM_QSTR(MP_QSTR_miso), mp_pin_make_new(NULL, 1, 0, &miso_obj),
709709
MP_ROM_QSTR(MP_QSTR_mosi), mp_pin_make_new(NULL, 1, 0, &mosi_obj),
710710
};
711-
spi = MP_OBJ_TO_PTR(machine_spi_type.make_new((mp_obj_t)&machine_spi_type, 2, 3, args));
711+
spi = MP_OBJ_TO_PTR(MP_OBJ_TYPE_GET_SLOT(&machine_spi_type, make_new)((mp_obj_t)&machine_spi_type, 2, 3, args));
712712

713713
cs = mp_hal_get_pin_obj(mp_pin_make_new(NULL, 1, 0, (mp_obj_t[]) {MP_OBJ_NEW_SMALL_INT(MICROPY_HW_WIZNET_PIN_CS)}));
714714
rst = mp_hal_get_pin_obj(mp_pin_make_new(NULL, 1, 0, (mp_obj_t[]) {MP_OBJ_NEW_SMALL_INT(MICROPY_HW_WIZNET_PIN_RST)}));
@@ -1020,15 +1020,15 @@ MP_DEFINE_CONST_OBJ_TYPE(
10201020
mod_network_nic_type_wiznet5k,
10211021
MP_QSTR_WIZNET5K,
10221022
MP_TYPE_FLAG_NONE,
1023-
wiznet5k_make_new,
1023+
make_new, wiznet5k_make_new,
10241024
locals_dict, &wiznet5k_locals_dict
10251025
);
10261026
#else // WIZNET5K_PROVIDED_STACK
10271027
STATIC MP_DEFINE_CONST_OBJ_FULL_TYPE(
10281028
mod_network_nic_type_wiznet5k_base,
10291029
MP_QSTR_WIZNET5K,
10301030
MP_TYPE_FLAG_NONE,
1031-
wiznet5k_make_new,
1031+
make_new, wiznet5k_make_new,
10321032
locals_dict, &wiznet5k_locals_dict
10331033
);
10341034

extmod/vfs.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ STATIC mp_obj_t mp_vfs_autodetect(mp_obj_t bdev_obj) {
173173
#if MICROPY_VFS_LFS1
174174
if (memcmp(&buf[32], "littlefs", 8) == 0) {
175175
// LFS1
176-
mp_obj_t vfs = mp_type_vfs_lfs1.make_new(&mp_type_vfs_lfs1, 1, 0, &bdev_obj);
176+
mp_obj_t vfs = MP_OBJ_TYPE_GET_SLOT(&mp_type_vfs_lfs1, make_new)(&mp_type_vfs_lfs1, 1, 0, &bdev_obj);
177177
nlr_pop();
178178
return vfs;
179179
}
180180
#endif
181181
#if MICROPY_VFS_LFS2
182182
if (memcmp(&buf[0], "littlefs", 8) == 0) {
183183
// LFS2
184-
mp_obj_t vfs = mp_type_vfs_lfs2.make_new(&mp_type_vfs_lfs2, 1, 0, &bdev_obj);
184+
mp_obj_t vfs = MP_OBJ_TYPE_GET_SLOT(&mp_type_vfs_lfs2, make_new)(&mp_type_vfs_lfs2, 1, 0, &bdev_obj);
185185
nlr_pop();
186186
return vfs;
187187
}
@@ -194,7 +194,7 @@ STATIC mp_obj_t mp_vfs_autodetect(mp_obj_t bdev_obj) {
194194
#endif
195195

196196
#if MICROPY_VFS_FAT
197-
return mp_fat_vfs_type.make_new(&mp_fat_vfs_type, 1, 0, &bdev_obj);
197+
return MP_OBJ_TYPE_GET_SLOT(&mp_fat_vfs_type, make_new)(&mp_fat_vfs_type, 1, 0, &bdev_obj);
198198
#endif
199199

200200
// no filesystem found

0 commit comments

Comments
 (0)