summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--drivers/ninaw10/nina_wifi_bsp.c2
-rw-r--r--examples/natmod/framebuf/framebuf.c6
-rw-r--r--examples/natmod/uzlib/uzlib.c6
-rw-r--r--extmod/machine_i2c.c2
-rw-r--r--extmod/machine_i2c.h2
-rw-r--r--extmod/machine_mem.c1
-rw-r--r--extmod/machine_pinbase.c2
-rw-r--r--extmod/machine_pwm.c2
-rw-r--r--extmod/machine_signal.c2
-rw-r--r--extmod/machine_spi.c2
-rw-r--r--extmod/machine_spi.h2
-rw-r--r--extmod/modbluetooth.c4
-rw-r--r--extmod/modbtree.c1
-rw-r--r--extmod/modframebuf.c2
-rw-r--r--extmod/modlwip.c4
-rw-r--r--extmod/moduasyncio.c4
-rw-r--r--extmod/moducryptolib.c2
-rw-r--r--extmod/moductypes.c2
-rw-r--r--extmod/moduhashlib.c6
-rw-r--r--extmod/modure.c2
-rw-r--r--extmod/moduselect.c1
-rw-r--r--extmod/modusocket.c2
-rw-r--r--extmod/modussl_axtls.c1
-rw-r--r--extmod/modussl_mbedtls.c1
-rw-r--r--extmod/modutimeq.c2
-rw-r--r--extmod/moduwebsocket.c2
-rw-r--r--extmod/moduzlib.c2
-rw-r--r--extmod/modwebrepl.c2
-rw-r--r--extmod/network_cyw43.c2
-rw-r--r--extmod/network_ninaw10.c4
-rw-r--r--extmod/network_wiznet5k.c6
-rw-r--r--extmod/vfs.c6
-rw-r--r--extmod/vfs_fat.c2
-rw-r--r--extmod/vfs_fat_file.c2
-rw-r--r--extmod/vfs_lfsx.c2
-rw-r--r--extmod/vfs_lfsx_file.c2
-rw-r--r--extmod/vfs_posix.c2
-rw-r--r--extmod/vfs_posix_file.c2
-rw-r--r--ports/cc3200/misc/mpirq.c1
-rw-r--r--ports/cc3200/mods/modnetwork.c2
-rw-r--r--ports/cc3200/mods/moduhashlib.c4
-rw-r--r--ports/cc3200/mods/modusocket.c2
-rw-r--r--ports/cc3200/mods/modwlan.c2
-rw-r--r--ports/cc3200/mods/pybadc.c3
-rw-r--r--ports/cc3200/mods/pybflash.c2
-rw-r--r--ports/cc3200/mods/pybi2c.c2
-rw-r--r--ports/cc3200/mods/pybpin.c3
-rw-r--r--ports/cc3200/mods/pybrtc.c2
-rw-r--r--ports/cc3200/mods/pybsd.c2
-rw-r--r--ports/cc3200/mods/pybsleep.c3
-rw-r--r--ports/cc3200/mods/pybspi.c2
-rw-r--r--ports/cc3200/mods/pybtimer.c3
-rw-r--r--ports/cc3200/mods/pybuart.c2
-rw-r--r--ports/cc3200/mods/pybwdt.c2
-rw-r--r--ports/esp32/esp32_nvs.c2
-rw-r--r--ports/esp32/esp32_partition.c2
-rw-r--r--ports/esp32/esp32_rmt.c2
-rw-r--r--ports/esp32/esp32_ulp.c2
-rw-r--r--ports/esp32/machine_adc.c2
-rw-r--r--ports/esp32/machine_adcblock.c2
-rw-r--r--ports/esp32/machine_dac.c2
-rw-r--r--ports/esp32/machine_hw_spi.c2
-rw-r--r--ports/esp32/machine_i2c.c2
-rw-r--r--ports/esp32/machine_i2s.c2
-rw-r--r--ports/esp32/machine_pin.c3
-rw-r--r--ports/esp32/machine_rtc.c2
-rw-r--r--ports/esp32/machine_sdcard.c2
-rw-r--r--ports/esp32/machine_timer.c2
-rw-r--r--ports/esp32/machine_touchpad.c2
-rw-r--r--ports/esp32/machine_uart.c2
-rw-r--r--ports/esp32/machine_wdt.c2
-rw-r--r--ports/esp32/modsocket.c2
-rw-r--r--ports/esp32/network_lan.c1
-rw-r--r--ports/esp32/network_ppp.c1
-rw-r--r--ports/esp32/network_wlan.c1
-rw-r--r--ports/esp8266/machine_adc.c2
-rw-r--r--ports/esp8266/machine_hspi.c2
-rw-r--r--ports/esp8266/machine_pin.c3
-rw-r--r--ports/esp8266/machine_rtc.c2
-rw-r--r--ports/esp8266/machine_uart.c2
-rw-r--r--ports/esp8266/machine_wdt.c2
-rw-r--r--ports/esp8266/main.c2
-rw-r--r--ports/esp8266/modmachine.c2
-rw-r--r--ports/esp8266/modnetwork.c1
-rw-r--r--ports/mimxrt/machine_adc.c2
-rw-r--r--ports/mimxrt/machine_i2c.c2
-rw-r--r--ports/mimxrt/machine_i2s.c2
-rw-r--r--ports/mimxrt/machine_led.c2
-rw-r--r--ports/mimxrt/machine_pin.c6
-rw-r--r--ports/mimxrt/machine_rtc.c2
-rw-r--r--ports/mimxrt/machine_sdcard.c2
-rw-r--r--ports/mimxrt/machine_spi.c2
-rw-r--r--ports/mimxrt/machine_timer.c2
-rw-r--r--ports/mimxrt/machine_uart.c2
-rw-r--r--ports/mimxrt/machine_wdt.c2
-rw-r--r--ports/mimxrt/mimxrt_flash.c2
-rw-r--r--ports/mimxrt/network_lan.c2
-rw-r--r--ports/nrf/boards/microbit/modules/iters.c1
-rw-r--r--ports/nrf/boards/microbit/modules/microbitdisplay.c1
-rw-r--r--ports/nrf/boards/microbit/modules/microbitimage.c4
-rw-r--r--ports/nrf/main.c2
-rw-r--r--ports/nrf/modules/board/led.c2
-rw-r--r--ports/nrf/modules/machine/adc.c2
-rw-r--r--ports/nrf/modules/machine/i2c.c2
-rw-r--r--ports/nrf/modules/machine/pin.c3
-rw-r--r--ports/nrf/modules/machine/pwm.c2
-rw-r--r--ports/nrf/modules/machine/rtcounter.c2
-rw-r--r--ports/nrf/modules/machine/spi.c2
-rw-r--r--ports/nrf/modules/machine/temp.c2
-rw-r--r--ports/nrf/modules/machine/timer.c2
-rw-r--r--ports/nrf/modules/machine/uart.c2
-rw-r--r--ports/nrf/modules/nrf/flashbdev.c2
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_characteristic.c2
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_constants.c2
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_delegate.c2
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_descriptor.c2
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_peripheral.c2
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_scan_entry.c1
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_scanner.c2
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_service.c2
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_uuid.c2
-rw-r--r--ports/nrf/modules/uos/microbitfs.c2
-rw-r--r--ports/nrf/pin_named_pins.c2
-rw-r--r--ports/pic16bit/modpybled.c2
-rw-r--r--ports/pic16bit/modpybswitch.c2
-rw-r--r--ports/renesas-ra/extint.c2
-rw-r--r--ports/renesas-ra/led.c2
-rw-r--r--ports/renesas-ra/machine_adc.c2
-rw-r--r--ports/renesas-ra/machine_i2c.c2
-rw-r--r--ports/renesas-ra/machine_pin.c4
-rw-r--r--ports/renesas-ra/machine_rtc.c2
-rw-r--r--ports/renesas-ra/machine_spi.c2
-rw-r--r--ports/renesas-ra/machine_timer.c2
-rw-r--r--ports/renesas-ra/machine_uart.c2
-rw-r--r--ports/renesas-ra/main.c2
-rw-r--r--ports/renesas-ra/storage.c2
-rw-r--r--ports/renesas-ra/timer.c3
-rw-r--r--ports/renesas-ra/usrsw.c2
-rw-r--r--ports/rp2/machine_adc.c2
-rw-r--r--ports/rp2/machine_i2c.c2
-rw-r--r--ports/rp2/machine_i2s.c2
-rw-r--r--ports/rp2/machine_pin.c2
-rw-r--r--ports/rp2/machine_rtc.c2
-rw-r--r--ports/rp2/machine_spi.c2
-rw-r--r--ports/rp2/machine_timer.c2
-rw-r--r--ports/rp2/machine_uart.c2
-rw-r--r--ports/rp2/machine_wdt.c2
-rw-r--r--ports/rp2/mpbthciport.c2
-rw-r--r--ports/rp2/rp2_flash.c2
-rw-r--r--ports/rp2/rp2_pio.c4
-rw-r--r--ports/samd/machine_led.c2
-rw-r--r--ports/samd/machine_pin.c2
-rw-r--r--ports/samd/samd_flash.c2
-rw-r--r--ports/stm32/accel.c2
-rw-r--r--ports/stm32/adc.c4
-rw-r--r--ports/stm32/boards/LEGO_HUB_NO6/cc2564.c2
-rw-r--r--ports/stm32/dac.c2
-rw-r--r--ports/stm32/extint.c2
-rw-r--r--ports/stm32/lcd.c2
-rw-r--r--ports/stm32/led.c2
-rw-r--r--ports/stm32/machine_adc.c2
-rw-r--r--ports/stm32/machine_i2c.c2
-rw-r--r--ports/stm32/machine_i2s.c2
-rw-r--r--ports/stm32/machine_spi.c2
-rw-r--r--ports/stm32/machine_timer.c2
-rw-r--r--ports/stm32/machine_uart.c2
-rw-r--r--ports/stm32/main.c2
-rw-r--r--ports/stm32/network_lan.c2
-rw-r--r--ports/stm32/pin.c3
-rw-r--r--ports/stm32/pin_named_pins.c2
-rw-r--r--ports/stm32/pyb_can.c2
-rw-r--r--ports/stm32/pyb_i2c.c2
-rw-r--r--ports/stm32/pyb_spi.c2
-rw-r--r--ports/stm32/rtc.c2
-rw-r--r--ports/stm32/sdcard.c4
-rw-r--r--ports/stm32/servo.c2
-rw-r--r--ports/stm32/storage.c2
-rw-r--r--ports/stm32/timer.c3
-rw-r--r--ports/stm32/usb.c4
-rw-r--r--ports/stm32/usrsw.c2
-rw-r--r--ports/stm32/wdt.c2
-rw-r--r--ports/teensy/led.c2
-rw-r--r--ports/teensy/timer.c3
-rw-r--r--ports/teensy/uart.c2
-rw-r--r--ports/unix/coverage.c2
-rw-r--r--ports/unix/main.c2
-rw-r--r--ports/unix/modffi.c8
-rw-r--r--ports/unix/modjni.c3
-rw-r--r--ports/unix/moduselect.c1
-rw-r--r--ports/unix/modusocket.c2
-rw-r--r--ports/zephyr/machine_i2c.c2
-rw-r--r--ports/zephyr/machine_pin.c2
-rw-r--r--ports/zephyr/machine_spi.c2
-rw-r--r--ports/zephyr/machine_uart.c2
-rw-r--r--ports/zephyr/main.c4
-rw-r--r--ports/zephyr/modusocket.c2
-rw-r--r--ports/zephyr/modzsensor.c2
-rw-r--r--ports/zephyr/zephyr_storage.c4
-rw-r--r--py/builtinevex.c3
-rw-r--r--py/dynruntime.h2
-rw-r--r--py/modbuiltins.c2
-rw-r--r--py/modio.c4
-rw-r--r--py/modthread.c1
-rw-r--r--py/obj.h56
-rw-r--r--py/objarray.c7
-rw-r--r--py/objattrtuple.c1
-rw-r--r--py/objbool.c2
-rw-r--r--py/objboundmeth.c1
-rw-r--r--py/objcell.c2
-rw-r--r--py/objclosure.c1
-rw-r--r--py/objcomplex.c3
-rw-r--r--py/objdeque.c2
-rw-r--r--py/objdict.c6
-rw-r--r--py/objenumerate.c2
-rw-r--r--py/objexcept.c12
-rw-r--r--py/objexcept.h3
-rw-r--r--py/objfilter.c2
-rw-r--r--py/objfloat.c3
-rw-r--r--py/objfun.c13
-rw-r--r--py/objgenerator.c3
-rw-r--r--py/objgetitemiter.c1
-rw-r--r--py/objint.c2
-rw-r--r--py/objlist.c4
-rw-r--r--py/objlist.h1
-rw-r--r--py/objmap.c2
-rw-r--r--py/objmodule.c1
-rw-r--r--py/objnamedtuple.c16
-rw-r--r--py/objnamedtuple.h4
-rw-r--r--py/objnone.c1
-rw-r--r--py/objobject.c2
-rw-r--r--py/objpolyiter.c2
-rw-r--r--py/objproperty.c2
-rw-r--r--py/objrange.c3
-rw-r--r--py/objreversed.c2
-rw-r--r--py/objset.c4
-rw-r--r--py/objsingleton.c2
-rw-r--r--py/objslice.c1
-rw-r--r--py/objstr.c6
-rw-r--r--py/objstringio.c4
-rw-r--r--py/objstrunicode.c2
-rw-r--r--py/objtuple.c2
-rw-r--r--py/objtype.c56
-rw-r--r--py/objtype.h4
-rw-r--r--py/objzip.c2
-rw-r--r--py/profile.c2
-rw-r--r--py/runtime.c1
-rw-r--r--shared/runtime/mpirq.c1
-rw-r--r--shared/runtime/sys_stdio_mphal.c2
248 files changed, 316 insertions, 397 deletions
diff --git a/drivers/ninaw10/nina_wifi_bsp.c b/drivers/ninaw10/nina_wifi_bsp.c
index d5b1308536..c65fb111fb 100644
--- a/drivers/ninaw10/nina_wifi_bsp.c
+++ b/drivers/ninaw10/nina_wifi_bsp.c
@@ -73,7 +73,7 @@ int nina_bsp_init(void) {
MP_OBJ_NEW_SMALL_INT(MICROPY_HW_WIFI_SPI_BAUDRATE),
};
- MP_STATE_PORT(mp_wifi_spi) = machine_spi_type.make_new((mp_obj_t)&machine_spi_type, 2, 0, args);
+ 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);
return 0;
}
diff --git a/examples/natmod/framebuf/framebuf.c b/examples/natmod/framebuf/framebuf.c
index 4c55729471..32b67eabcf 100644
--- a/examples/natmod/framebuf/framebuf.c
+++ b/examples/natmod/framebuf/framebuf.c
@@ -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
mp_type_framebuf.base.type = (void*)&mp_type_type;
mp_type_framebuf.name = MP_QSTR_FrameBuffer;
- mp_type_framebuf.make_new = framebuf_make_new;
- MP_OBJ_TYPE_SET_SLOT(&mp_type_framebuf, buffer, framebuf_get_buffer, 0);
+ MP_OBJ_TYPE_SET_SLOT(&mp_type_framebuf, make_new, framebuf_make_new, 0);
+ MP_OBJ_TYPE_SET_SLOT(&mp_type_framebuf, buffer, framebuf_get_buffer, 1);
framebuf_locals_dict_table[0] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_fill), MP_OBJ_FROM_PTR(&framebuf_fill_obj) };
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) };
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
framebuf_locals_dict_table[8] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_blit), MP_OBJ_FROM_PTR(&framebuf_blit_obj) };
framebuf_locals_dict_table[9] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_scroll), MP_OBJ_FROM_PTR(&framebuf_scroll_obj) };
framebuf_locals_dict_table[10] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_text), MP_OBJ_FROM_PTR(&framebuf_text_obj) };
- MP_OBJ_TYPE_SET_SLOT(&mp_type_framebuf, locals_dict, (void*)&framebuf_locals_dict, 1);
+ MP_OBJ_TYPE_SET_SLOT(&mp_type_framebuf, locals_dict, (void*)&framebuf_locals_dict, 2);
mp_store_global(MP_QSTR_FrameBuffer, MP_OBJ_FROM_PTR(&mp_type_framebuf));
mp_store_global(MP_QSTR_FrameBuffer1, MP_OBJ_FROM_PTR(&legacy_framebuffer1_obj));
diff --git a/examples/natmod/uzlib/uzlib.c b/examples/natmod/uzlib/uzlib.c
index 469452e8f8..9cf58b10e7 100644
--- a/examples/natmod/uzlib/uzlib.c
+++ b/examples/natmod/uzlib/uzlib.c
@@ -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
decompio_type.base.type = mp_fun_table.type_type;
decompio_type.name = MP_QSTR_DecompIO;
- decompio_type.make_new = &decompio_make_new;
- MP_OBJ_TYPE_SET_SLOT(&decompio_type, protocol, &decompio_stream_p, 0);
+ MP_OBJ_TYPE_SET_SLOT(&decompio_type, make_new, &decompio_make_new, 0);
+ MP_OBJ_TYPE_SET_SLOT(&decompio_type, protocol, &decompio_stream_p, 1);
decompio_locals_dict_table[0] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_read), MP_OBJ_FROM_PTR(&mp_stream_read_obj) };
decompio_locals_dict_table[1] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_readinto), MP_OBJ_FROM_PTR(&mp_stream_readinto_obj) };
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) };
- MP_OBJ_TYPE_SET_SLOT(&decompio_type, locals_dict, (void*)&decompio_locals_dict, 1);
+ MP_OBJ_TYPE_SET_SLOT(&decompio_type, locals_dict, (void*)&decompio_locals_dict, 2);
mp_store_global(MP_QSTR___name__, MP_OBJ_NEW_QSTR(MP_QSTR_uzlib));
mp_store_global(MP_QSTR_decompress, MP_OBJ_FROM_PTR(&mod_uzlib_decompress_obj));
diff --git a/extmod/machine_i2c.c b/extmod/machine_i2c.c
index bb7ade6fcf..3563b3243c 100644
--- a/extmod/machine_i2c.c
+++ b/extmod/machine_i2c.c
@@ -734,7 +734,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_machine_soft_i2c_type,
MP_QSTR_SoftI2C,
MP_TYPE_FLAG_NONE,
- mp_machine_soft_i2c_make_new,
+ make_new, mp_machine_soft_i2c_make_new,
print, mp_machine_soft_i2c_print,
protocol, &mp_machine_soft_i2c_p,
locals_dict, &mp_machine_i2c_locals_dict
diff --git a/extmod/machine_i2c.h b/extmod/machine_i2c.h
index a3363d4c34..600145bfed 100644
--- a/extmod/machine_i2c.h
+++ b/extmod/machine_i2c.h
@@ -38,7 +38,7 @@
--n_args; \
++all_args; \
} \
- return mp_machine_soft_i2c_type.make_new(&mp_machine_soft_i2c_type, n_args, n_kw, all_args); \
+ return MP_OBJ_TYPE_GET_SLOT(&mp_machine_soft_i2c_type, make_new)(&mp_machine_soft_i2c_type, n_args, n_kw, all_args); \
} \
} while (0)
diff --git a/extmod/machine_mem.c b/extmod/machine_mem.c
index 422e99d3ce..f27356e028 100644
--- a/extmod/machine_mem.c
+++ b/extmod/machine_mem.c
@@ -105,7 +105,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_mem_type,
MP_QSTR_mem,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, machine_mem_print,
subscr, machine_mem_subscr
);
diff --git a/extmod/machine_pinbase.c b/extmod/machine_pinbase.c
index 617dd1280c..8607e6ed3d 100644
--- a/extmod/machine_pinbase.c
+++ b/extmod/machine_pinbase.c
@@ -81,7 +81,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_pinbase_type,
MP_QSTR_PinBase,
MP_TYPE_FLAG_NONE,
- pinbase_make_new,
+ make_new, pinbase_make_new,
protocol, &pinbase_pin_p
);
diff --git a/extmod/machine_pwm.c b/extmod/machine_pwm.c
index f12f70a2d1..220d34d7da 100644
--- a/extmod/machine_pwm.c
+++ b/extmod/machine_pwm.c
@@ -136,7 +136,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_pwm_type,
MP_QSTR_PWM,
MP_TYPE_FLAG_NONE,
- mp_machine_pwm_make_new,
+ make_new, mp_machine_pwm_make_new,
print, mp_machine_pwm_print,
locals_dict, &machine_pwm_locals_dict
);
diff --git a/extmod/machine_signal.c b/extmod/machine_signal.c
index 49ee6dfb4a..7922ed7077 100644
--- a/extmod/machine_signal.c
+++ b/extmod/machine_signal.c
@@ -176,7 +176,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_signal_type,
MP_QSTR_Signal,
MP_TYPE_FLAG_NONE,
- signal_make_new,
+ make_new, signal_make_new,
call, signal_call,
protocol, &signal_pin_p,
locals_dict, &signal_locals_dict
diff --git a/extmod/machine_spi.c b/extmod/machine_spi.c
index 54f1964e21..bb35cff38e 100644
--- a/extmod/machine_spi.c
+++ b/extmod/machine_spi.c
@@ -255,7 +255,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_machine_soft_spi_type,
MP_QSTR_SoftSPI,
MP_TYPE_FLAG_NONE,
- mp_machine_soft_spi_make_new,
+ make_new, mp_machine_soft_spi_make_new,
print, mp_machine_soft_spi_print,
protocol, &mp_machine_soft_spi_p,
locals_dict, &mp_machine_spi_locals_dict
diff --git a/extmod/machine_spi.h b/extmod/machine_spi.h
index ca92c719a8..93ee8d00ca 100644
--- a/extmod/machine_spi.h
+++ b/extmod/machine_spi.h
@@ -39,7 +39,7 @@
--n_args; \
++all_args; \
} \
- return mp_machine_soft_spi_type.make_new(&mp_machine_soft_spi_type, n_args, n_kw, all_args); \
+ return MP_OBJ_TYPE_GET_SLOT(&mp_machine_soft_spi_type, make_new)(&mp_machine_soft_spi_type, n_args, n_kw, all_args); \
} \
} while (0)
diff --git a/extmod/modbluetooth.c b/extmod/modbluetooth.c
index 2e058fc7de..9c168483ba 100644
--- a/extmod/modbluetooth.c
+++ b/extmod/modbluetooth.c
@@ -244,7 +244,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_bluetooth_uuid,
MP_QSTR_UUID,
MP_TYPE_FLAG_NONE,
- bluetooth_uuid_make_new,
+ make_new, bluetooth_uuid_make_new,
unary_op, bluetooth_uuid_unary_op,
binary_op, bluetooth_uuid_binary_op,
print, bluetooth_uuid_print,
@@ -980,7 +980,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_bluetooth_ble,
MP_QSTR_BLE,
MP_TYPE_FLAG_NONE,
- bluetooth_ble_make_new,
+ make_new, bluetooth_ble_make_new,
locals_dict, &bluetooth_ble_locals_dict
);
diff --git a/extmod/modbtree.c b/extmod/modbtree.c
index f21fe3ff94..2da65a2c7a 100644
--- a/extmod/modbtree.c
+++ b/extmod/modbtree.c
@@ -328,7 +328,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
btree_type,
MP_QSTR_btree,
MP_TYPE_FLAG_ITER_IS_CUSTOM,
- MP_TYPE_NULL_MAKE_NEW,
// Save on qstr's, reuse same as for module
print, btree_print,
iter, &btree_getiter_iternext,
diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c
index 5347be5643..e7825b5912 100644
--- a/extmod/modframebuf.c
+++ b/extmod/modframebuf.c
@@ -833,7 +833,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_framebuf,
MP_QSTR_FrameBuffer,
MP_TYPE_FLAG_NONE,
- framebuf_make_new,
+ make_new, framebuf_make_new,
buffer, framebuf_get_buffer,
locals_dict, &framebuf_locals_dict
);
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index 2f5da36f40..f64a5a6250 100644
--- a/extmod/modlwip.c
+++ b/extmod/modlwip.c
@@ -181,7 +181,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
lwip_slip_type,
MP_QSTR_slip,
MP_TYPE_FLAG_NONE,
- lwip_slip_make_new,
+ make_new, lwip_slip_make_new,
locals_dict, &lwip_slip_locals_dict
);
@@ -1599,7 +1599,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
lwip_socket_type,
MP_QSTR_socket,
MP_TYPE_FLAG_NONE,
- lwip_socket_make_new,
+ make_new, lwip_socket_make_new,
print, lwip_socket_print,
protocol, &lwip_socket_stream_p,
locals_dict, &lwip_socket_locals_dict
diff --git a/extmod/moduasyncio.c b/extmod/moduasyncio.c
index b0eb8b6509..021e0da1be 100644
--- a/extmod/moduasyncio.c
+++ b/extmod/moduasyncio.c
@@ -148,7 +148,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
task_queue_type,
MP_QSTR_TaskQueue,
MP_TYPE_FLAG_NONE,
- task_queue_make_new,
+ make_new, task_queue_make_new,
locals_dict, &task_queue_locals_dict
);
@@ -296,7 +296,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
task_type,
MP_QSTR_Task,
MP_TYPE_FLAG_ITER_IS_CUSTOM,
- task_make_new,
+ make_new, task_make_new,
attr, task_attr,
iter, &task_getiter_iternext
);
diff --git a/extmod/moducryptolib.c b/extmod/moducryptolib.c
index e4625c21a8..fc3fcfd90d 100644
--- a/extmod/moducryptolib.c
+++ b/extmod/moducryptolib.c
@@ -352,7 +352,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
ucryptolib_aes_type,
MP_QSTR_aes,
MP_TYPE_FLAG_NONE,
- ucryptolib_aes_make_new,
+ make_new, ucryptolib_aes_make_new,
locals_dict, &ucryptolib_aes_locals_dict
);
diff --git a/extmod/moductypes.c b/extmod/moductypes.c
index a9ad500c2d..15c36290a9 100644
--- a/extmod/moductypes.c
+++ b/extmod/moductypes.c
@@ -638,7 +638,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
uctypes_struct_type,
MP_QSTR_struct,
MP_TYPE_FLAG_NONE,
- uctypes_struct_make_new,
+ make_new, uctypes_struct_make_new,
print, uctypes_struct_print,
attr, uctypes_struct_attr,
subscr, uctypes_struct_subscr,
diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c
index 9535e00b40..64e15c444d 100644
--- a/extmod/moduhashlib.c
+++ b/extmod/moduhashlib.c
@@ -161,7 +161,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
uhashlib_sha256_type,
MP_QSTR_sha256,
MP_TYPE_FLAG_NONE,
- uhashlib_sha256_make_new,
+ make_new, uhashlib_sha256_make_new,
locals_dict, &uhashlib_sha256_locals_dict
);
#endif
@@ -255,7 +255,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
uhashlib_sha1_type,
MP_QSTR_sha1,
MP_TYPE_FLAG_NONE,
- uhashlib_sha1_make_new,
+ make_new, uhashlib_sha1_make_new,
locals_dict, &uhashlib_sha1_locals_dict
);
#endif
@@ -349,7 +349,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
uhashlib_md5_type,
MP_QSTR_md5,
MP_TYPE_FLAG_NONE,
- uhashlib_md5_make_new,
+ make_new, uhashlib_md5_make_new,
locals_dict, &uhashlib_md5_locals_dict
);
#endif // MICROPY_PY_UHASHLIB_MD5
diff --git a/extmod/modure.c b/extmod/modure.c
index c0114c14fd..801e5df897 100644
--- a/extmod/modure.c
+++ b/extmod/modure.c
@@ -183,7 +183,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
match_type,
MP_QSTR_match,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, match_print,
locals_dict, &match_locals_dict
);
@@ -417,7 +416,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
re_type,
MP_QSTR_ure,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, re_print,
locals_dict, &re_locals_dict
);
diff --git a/extmod/moduselect.c b/extmod/moduselect.c
index 58bd1169a9..128154a4b6 100644
--- a/extmod/moduselect.c
+++ b/extmod/moduselect.c
@@ -340,7 +340,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_poll,
MP_QSTR_poll,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
iter, poll_iternext,
locals_dict, &poll_locals_dict
);
diff --git a/extmod/modusocket.c b/extmod/modusocket.c
index fc16d7e270..194ee6899e 100644
--- a/extmod/modusocket.c
+++ b/extmod/modusocket.c
@@ -532,7 +532,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
socket_type,
MP_QSTR_socket,
MP_TYPE_FLAG_NONE,
- socket_make_new,
+ make_new, socket_make_new,
protocol, &socket_stream_p,
locals_dict, &socket_locals_dict,
print, socket_print
diff --git a/extmod/modussl_axtls.c b/extmod/modussl_axtls.c
index a6d606d560..2eae465048 100644
--- a/extmod/modussl_axtls.c
+++ b/extmod/modussl_axtls.c
@@ -318,7 +318,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
ussl_socket_type,
MP_QSTR_ussl,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
// Save on qstr's, reuse same as for module
print, ussl_socket_print,
protocol, &ussl_socket_stream_p,
diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c
index 50712980ba..95cf12c975 100644
--- a/extmod/modussl_mbedtls.c
+++ b/extmod/modussl_mbedtls.c
@@ -396,7 +396,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
ussl_socket_type,
MP_QSTR_ussl,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
// Save on qstr's, reuse same as for module
print, socket_print,
protocol, &ussl_socket_stream_p,
diff --git a/extmod/modutimeq.c b/extmod/modutimeq.c
index 1a7575adc9..1a38104eaf 100644
--- a/extmod/modutimeq.c
+++ b/extmod/modutimeq.c
@@ -213,7 +213,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
utimeq_type,
MP_QSTR_utimeq,
MP_TYPE_FLAG_NONE,
- utimeq_make_new,
+ make_new, utimeq_make_new,
unary_op, utimeq_unary_op,
locals_dict, &utimeq_locals_dict
);
diff --git a/extmod/moduwebsocket.c b/extmod/moduwebsocket.c
index c6be50d0e1..9b12fc8635 100644
--- a/extmod/moduwebsocket.c
+++ b/extmod/moduwebsocket.c
@@ -294,7 +294,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
websocket_type,
MP_QSTR_websocket,
MP_TYPE_FLAG_NONE,
- websocket_make_new,
+ make_new, websocket_make_new,
protocol, &websocket_stream_p,
locals_dict, &websocket_locals_dict
);
diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c
index 533168d0b0..14d15321a3 100644
--- a/extmod/moduzlib.c
+++ b/extmod/moduzlib.c
@@ -144,7 +144,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
decompio_type,
MP_QSTR_DecompIO,
MP_TYPE_FLAG_NONE,
- decompio_make_new,
+ make_new, decompio_make_new,
protocol, &decompio_stream_p,
locals_dict, &decompio_locals_dict
);
diff --git a/extmod/modwebrepl.c b/extmod/modwebrepl.c
index fc5ca35ea0..d86f358962 100644
--- a/extmod/modwebrepl.c
+++ b/extmod/modwebrepl.c
@@ -346,7 +346,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
webrepl_type,
MP_QSTR__webrepl,
MP_TYPE_FLAG_NONE,
- webrepl_make_new,
+ make_new, webrepl_make_new,
protocol, &webrepl_stream_p,
locals_dict, &webrepl_locals_dict
);
diff --git a/extmod/network_cyw43.c b/extmod/network_cyw43.c
index 329ba53ef5..87d9b9f614 100644
--- a/extmod/network_cyw43.c
+++ b/extmod/network_cyw43.c
@@ -500,7 +500,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_network_cyw43_type,
MP_QSTR_CYW43,
MP_TYPE_FLAG_NONE,
- network_cyw43_make_new,
+ make_new, network_cyw43_make_new,
print, network_cyw43_print,
locals_dict, &network_cyw43_locals_dict
);
diff --git a/extmod/network_ninaw10.c b/extmod/network_ninaw10.c
index 806819648d..f4cc0b2224 100644
--- a/extmod/network_ninaw10.c
+++ b/extmod/network_ninaw10.c
@@ -159,7 +159,7 @@ STATIC mp_obj_t network_ninaw10_active(size_t n_args, const mp_obj_t *args) {
MP_OBJ_NEW_QSTR(MP_QSTR_freq), MP_OBJ_NEW_SMALL_INT(10),
MP_OBJ_NEW_QSTR(MP_QSTR_callback), MP_OBJ_FROM_PTR(&network_ninaw10_timer_callback_obj),
};
- MP_STATE_PORT(mp_wifi_timer) = machine_timer_type.make_new((mp_obj_t)&machine_timer_type, 0, 2, timer_args);
+ 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);
}
} else {
nina_deinit();
@@ -778,7 +778,7 @@ STATIC MP_DEFINE_CONST_OBJ_FULL_TYPE(
mod_network_nic_type_nina_base,
MP_QSTR_nina,
MP_TYPE_FLAG_NONE,
- network_ninaw10_make_new,
+ make_new, network_ninaw10_make_new,
locals_dict, &nina_locals_dict
);
diff --git a/extmod/network_wiznet5k.c b/extmod/network_wiznet5k.c
index 82f836f691..af20145081 100644
--- a/extmod/network_wiznet5k.c
+++ b/extmod/network_wiznet5k.c
@@ -708,7 +708,7 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size
MP_ROM_QSTR(MP_QSTR_miso), mp_pin_make_new(NULL, 1, 0, &miso_obj),
MP_ROM_QSTR(MP_QSTR_mosi), mp_pin_make_new(NULL, 1, 0, &mosi_obj),
};
- spi = MP_OBJ_TO_PTR(machine_spi_type.make_new((mp_obj_t)&machine_spi_type, 2, 3, args));
+ spi = MP_OBJ_TO_PTR(MP_OBJ_TYPE_GET_SLOT(&machine_spi_type, make_new)((mp_obj_t)&machine_spi_type, 2, 3, args));
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)}));
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,7 +1020,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mod_network_nic_type_wiznet5k,
MP_QSTR_WIZNET5K,
MP_TYPE_FLAG_NONE,
- wiznet5k_make_new,
+ make_new, wiznet5k_make_new,
locals_dict, &wiznet5k_locals_dict
);
#else // WIZNET5K_PROVIDED_STACK
@@ -1028,7 +1028,7 @@ STATIC MP_DEFINE_CONST_OBJ_FULL_TYPE(
mod_network_nic_type_wiznet5k_base,
MP_QSTR_WIZNET5K,
MP_TYPE_FLAG_NONE,
- wiznet5k_make_new,
+ make_new, wiznet5k_make_new,
locals_dict, &wiznet5k_locals_dict
);
diff --git a/extmod/vfs.c b/extmod/vfs.c
index 00450e1005..af63ceb37e 100644
--- a/extmod/vfs.c
+++ b/extmod/vfs.c
@@ -173,7 +173,7 @@ STATIC mp_obj_t mp_vfs_autodetect(mp_obj_t bdev_obj) {
#if MICROPY_VFS_LFS1
if (memcmp(&buf[32], "littlefs", 8) == 0) {
// LFS1
- mp_obj_t vfs = mp_type_vfs_lfs1.make_new(&mp_type_vfs_lfs1, 1, 0, &bdev_obj);
+ mp_obj_t vfs = MP_OBJ_TYPE_GET_SLOT(&mp_type_vfs_lfs1, make_new)(&mp_type_vfs_lfs1, 1, 0, &bdev_obj);
nlr_pop();
return vfs;
}
@@ -181,7 +181,7 @@ STATIC mp_obj_t mp_vfs_autodetect(mp_obj_t bdev_obj) {
#if MICROPY_VFS_LFS2
if (memcmp(&buf[0], "littlefs", 8) == 0) {
// LFS2
- mp_obj_t vfs = mp_type_vfs_lfs2.make_new(&mp_type_vfs_lfs2, 1, 0, &bdev_obj);
+ mp_obj_t vfs = MP_OBJ_TYPE_GET_SLOT(&mp_type_vfs_lfs2, make_new)(&mp_type_vfs_lfs2, 1, 0, &bdev_obj);
nlr_pop();
return vfs;
}
@@ -194,7 +194,7 @@ STATIC mp_obj_t mp_vfs_autodetect(mp_obj_t bdev_obj) {
#endif
#if MICROPY_VFS_FAT
- return mp_fat_vfs_type.make_new(&mp_fat_vfs_type, 1, 0, &bdev_obj);
+ return MP_OBJ_TYPE_GET_SLOT(&mp_fat_vfs_type, make_new)(&mp_fat_vfs_type, 1, 0, &bdev_obj);
#endif
// no filesystem found
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c
index 7c18a51633..efb6bf7e98 100644
--- a/extmod/vfs_fat.c
+++ b/extmod/vfs_fat.c
@@ -435,7 +435,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_fat_vfs_type,
MP_QSTR_VfsFat,
MP_TYPE_FLAG_NONE,
- fat_vfs_make_new,
+ make_new, fat_vfs_make_new,
protocol, &fat_vfs_proto,
locals_dict, &fat_vfs_locals_dict
);
diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c
index ca2e2b446f..07e6df9bf9 100644
--- a/extmod/vfs_fat_file.c
+++ b/extmod/vfs_fat_file.c
@@ -180,7 +180,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_vfs_fat_fileio,
MP_QSTR_FileIO,
MP_TYPE_FLAG_ITER_IS_STREAM,
- MP_TYPE_NULL_MAKE_NEW,
print, file_obj_print,
protocol, &vfs_fat_fileio_stream_p,
locals_dict, &vfs_fat_rawfile_locals_dict
@@ -197,7 +196,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_vfs_fat_textio,
MP_QSTR_TextIOWrapper,
MP_TYPE_FLAG_ITER_IS_STREAM,
- MP_TYPE_NULL_MAKE_NEW,
print, file_obj_print,
protocol, &vfs_fat_textio_stream_p,
locals_dict, &vfs_fat_rawfile_locals_dict
diff --git a/extmod/vfs_lfsx.c b/extmod/vfs_lfsx.c
index 33e2ef5519..d9617817f9 100644
--- a/extmod/vfs_lfsx.c
+++ b/extmod/vfs_lfsx.c
@@ -512,7 +512,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
MP_TYPE_VFS_LFSx,
VFS_LFSx_QSTR,
MP_TYPE_FLAG_NONE,
- MP_VFS_LFSx(make_new),
+ make_new, MP_VFS_LFSx(make_new),
protocol, &MP_VFS_LFSx(proto),
locals_dict, &MP_VFS_LFSx(locals_dict)
);
diff --git a/extmod/vfs_lfsx_file.c b/extmod/vfs_lfsx_file.c
index f97641b7b9..2c87fd5b99 100644
--- a/extmod/vfs_lfsx_file.c
+++ b/extmod/vfs_lfsx_file.c
@@ -224,7 +224,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
MP_TYPE_VFS_LFSx_(_fileio),
MP_QSTR_FileIO,
MP_TYPE_FLAG_ITER_IS_STREAM,
- MP_TYPE_NULL_MAKE_NEW,
print, MP_VFS_LFSx(file_print),
protocol, &MP_VFS_LFSx(fileio_stream_p),
locals_dict, &MP_VFS_LFSx(file_locals_dict)
@@ -241,7 +240,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
MP_TYPE_VFS_LFSx_(_textio),
MP_QSTR_TextIOWrapper,
MP_TYPE_FLAG_ITER_IS_STREAM,
- MP_TYPE_NULL_MAKE_NEW,
print, MP_VFS_LFSx(file_print),
protocol, &MP_VFS_LFSx(textio_stream_p),
locals_dict, &MP_VFS_LFSx(file_locals_dict)
diff --git a/extmod/vfs_posix.c b/extmod/vfs_posix.c
index b02827e864..3694ebaf99 100644
--- a/extmod/vfs_posix.c
+++ b/extmod/vfs_posix.c
@@ -402,7 +402,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_vfs_posix,
MP_QSTR_VfsPosix,
MP_TYPE_FLAG_NONE,
- vfs_posix_make_new,
+ make_new, vfs_posix_make_new,
protocol, &vfs_posix_proto,
locals_dict, &vfs_posix_locals_dict
);
diff --git a/extmod/vfs_posix_file.c b/extmod/vfs_posix_file.c
index 729d914d3a..4a37489686 100644
--- a/extmod/vfs_posix_file.c
+++ b/extmod/vfs_posix_file.c
@@ -253,7 +253,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_vfs_posix_fileio,
MP_QSTR_FileIO,
MP_TYPE_FLAG_ITER_IS_STREAM,
- MP_TYPE_NULL_MAKE_NEW,
print, vfs_posix_file_print,
protocol, &vfs_posix_fileio_stream_p,
locals_dict, &vfs_posix_rawfile_locals_dict
@@ -270,7 +269,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_vfs_posix_textio,
MP_QSTR_TextIOWrapper,
MP_TYPE_FLAG_ITER_IS_STREAM,
- MP_TYPE_NULL_MAKE_NEW,
print, vfs_posix_file_print,
protocol, &vfs_posix_textio_stream_p,
locals_dict, &vfs_posix_rawfile_locals_dict
diff --git a/ports/cc3200/misc/mpirq.c b/ports/cc3200/misc/mpirq.c
index 9c3c2f7196..eb813fa4c6 100644
--- a/ports/cc3200/misc/mpirq.c
+++ b/ports/cc3200/misc/mpirq.c
@@ -194,7 +194,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_irq_type,
MP_QSTR_irq,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
call, mp_irq_call,
locals_dict, &mp_irq_locals_dict
);
diff --git a/ports/cc3200/mods/modnetwork.c b/ports/cc3200/mods/modnetwork.c
index 0a72a1ab32..590e872683 100644
--- a/ports/cc3200/mods/modnetwork.c
+++ b/ports/cc3200/mods/modnetwork.c
@@ -175,7 +175,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
network_server_type,
MP_QSTR_Server,
MP_TYPE_FLAG_NONE,
- network_server_make_new,
+ make_new, network_server_make_new,
locals_dict, &network_server_locals_dict
);
#endif
diff --git a/ports/cc3200/mods/moduhashlib.c b/ports/cc3200/mods/moduhashlib.c
index 4a759d8ea5..302ff335ff 100644
--- a/ports/cc3200/mods/moduhashlib.c
+++ b/ports/cc3200/mods/moduhashlib.c
@@ -181,7 +181,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
sha1_type,
MP_QSTR_sha1,
MP_TYPE_FLAG_NONE,
- hash_make_new,
+ make_new, hash_make_new,
locals_dict, &hash_locals_dict
);
@@ -189,7 +189,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
sha256_type,
MP_QSTR_sha256,
MP_TYPE_FLAG_NONE,
- hash_make_new,
+ make_new, hash_make_new,
locals_dict, &hash_locals_dict
);
diff --git a/ports/cc3200/mods/modusocket.c b/ports/cc3200/mods/modusocket.c
index 55d504a709..cd1489fb4a 100644
--- a/ports/cc3200/mods/modusocket.c
+++ b/ports/cc3200/mods/modusocket.c
@@ -763,7 +763,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
socket_type,
MP_QSTR_socket,
MP_TYPE_FLAG_NONE,
- socket_make_new,
+ make_new, socket_make_new,
protocol, &socket_stream_p,
locals_dict, &socket_locals_dict
);
diff --git a/ports/cc3200/mods/modwlan.c b/ports/cc3200/mods/modwlan.c
index 1e82b07e08..6cf1cbee4e 100644
--- a/ports/cc3200/mods/modwlan.c
+++ b/ports/cc3200/mods/modwlan.c
@@ -1289,7 +1289,7 @@ STATIC MP_DEFINE_CONST_OBJ_FULL_TYPE(
mod_network_nic_type_wlan_base,
MP_QSTR_WLAN,
MP_TYPE_FLAG_NONE,
- wlan_make_new,
+ make_new, wlan_make_new,
locals_dict, &wlan_locals_dict
);
diff --git a/ports/cc3200/mods/pybadc.c b/ports/cc3200/mods/pybadc.c
index a14f9aced2..7466428256 100644
--- a/ports/cc3200/mods/pybadc.c
+++ b/ports/cc3200/mods/pybadc.c
@@ -237,7 +237,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_adc_type,
MP_QSTR_ADC,
MP_TYPE_FLAG_NONE,
- adc_make_new,
+ make_new, adc_make_new,
print, adc_print,
locals_dict, &adc_locals_dict
);
@@ -305,7 +305,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
pyb_adc_channel_type,
MP_QSTR_ADCChannel,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, adc_channel_print,
call, adc_channel_call,
locals_dict, &adc_channel_locals_dict
diff --git a/ports/cc3200/mods/pybflash.c b/ports/cc3200/mods/pybflash.c
index a6d1e23fbf..46b7be234f 100644
--- a/ports/cc3200/mods/pybflash.c
+++ b/ports/cc3200/mods/pybflash.c
@@ -88,7 +88,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_flash_type,
MP_QSTR_Flash,
MP_TYPE_FLAG_NONE,
- pyb_flash_make_new,
+ make_new, pyb_flash_make_new,
locals_dict, &pyb_flash_locals_dict
);
diff --git a/ports/cc3200/mods/pybi2c.c b/ports/cc3200/mods/pybi2c.c
index de92cc7c32..5d77dc8367 100644
--- a/ports/cc3200/mods/pybi2c.c
+++ b/ports/cc3200/mods/pybi2c.c
@@ -525,7 +525,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_i2c_type,
MP_QSTR_I2C,
MP_TYPE_FLAG_NONE,
- pyb_i2c_make_new,
+ make_new, pyb_i2c_make_new,
print, pyb_i2c_print,
locals_dict, &pyb_i2c_locals_dict
);
diff --git a/ports/cc3200/mods/pybpin.c b/ports/cc3200/mods/pybpin.c
index 374d09ddfb..f04ca75654 100644
--- a/ports/cc3200/mods/pybpin.c
+++ b/ports/cc3200/mods/pybpin.c
@@ -935,7 +935,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_type,
MP_QSTR_Pin,
MP_TYPE_FLAG_NONE,
- pin_make_new,
+ make_new, pin_make_new,
print, pin_print,
call, pin_call,
locals_dict, &pin_locals_dict
@@ -957,7 +957,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_board_pins_obj_type,
MP_QSTR_board,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, pin_named_pins_obj_print,
locals_dict, &pin_board_pins_locals_dict
);
diff --git a/ports/cc3200/mods/pybrtc.c b/ports/cc3200/mods/pybrtc.c
index ed7a20fecb..21e729dbf1 100644
--- a/ports/cc3200/mods/pybrtc.c
+++ b/ports/cc3200/mods/pybrtc.c
@@ -473,7 +473,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_rtc_type,
MP_QSTR_RTC,
MP_TYPE_FLAG_NONE,
- pyb_rtc_make_new,
+ make_new, pyb_rtc_make_new,
locals_dict, &pyb_rtc_locals_dict
);
diff --git a/ports/cc3200/mods/pybsd.c b/ports/cc3200/mods/pybsd.c
index 968a6a87ec..209c3b5a85 100644
--- a/ports/cc3200/mods/pybsd.c
+++ b/ports/cc3200/mods/pybsd.c
@@ -216,6 +216,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_sd_type,
MP_QSTR_SD,
MP_TYPE_FLAG_NONE,
- pyb_sd_make_new,
+ make_new, pyb_sd_make_new,
locals_dict, &pyb_sd_locals_dict
);
diff --git a/ports/cc3200/mods/pybsleep.c b/ports/cc3200/mods/pybsleep.c
index 423099991f..ffb281e6b1 100644
--- a/ports/cc3200/mods/pybsleep.c
+++ b/ports/cc3200/mods/pybsleep.c
@@ -128,8 +128,7 @@ STATIC pybsleep_wake_reason_t pybsleep_wake_reason = PYB_SLP_WAKED_PWRON;
STATIC MP_DEFINE_CONST_OBJ_TYPE(
pyb_sleep_type,
MP_QSTR_sleep,
- MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW
+ MP_TYPE_FLAG_NONE
);
/******************************************************************************
diff --git a/ports/cc3200/mods/pybspi.c b/ports/cc3200/mods/pybspi.c
index 7d83fabfde..61086ec2e1 100644
--- a/ports/cc3200/mods/pybspi.c
+++ b/ports/cc3200/mods/pybspi.c
@@ -381,7 +381,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_spi_type,
MP_QSTR_SPI,
MP_TYPE_FLAG_NONE,
- pyb_spi_make_new,
+ make_new, pyb_spi_make_new,
print, pyb_spi_print,
locals_dict, &pyb_spi_locals_dict
);
diff --git a/ports/cc3200/mods/pybtimer.c b/ports/cc3200/mods/pybtimer.c
index 14e1deb083..be365f3c92 100644
--- a/ports/cc3200/mods/pybtimer.c
+++ b/ports/cc3200/mods/pybtimer.c
@@ -463,7 +463,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_type,
MP_QSTR_Timer,
MP_TYPE_FLAG_NONE,
- pyb_timer_make_new,
+ make_new, pyb_timer_make_new,
print, pyb_timer_print,
locals_dict, &pyb_timer_locals_dict
);
@@ -726,7 +726,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_channel_type,
MP_QSTR_TimerChannel,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, pyb_timer_channel_print,
locals_dict, &pyb_timer_channel_locals_dict
);
diff --git a/ports/cc3200/mods/pybuart.c b/ports/cc3200/mods/pybuart.c
index f92f544732..424ca251ec 100644
--- a/ports/cc3200/mods/pybuart.c
+++ b/ports/cc3200/mods/pybuart.c
@@ -689,7 +689,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_ITER_IS_STREAM,
- pyb_uart_make_new,
+ make_new, pyb_uart_make_new,
print, pyb_uart_print,
protocol, &uart_stream_p,
locals_dict, &pyb_uart_locals_dict
diff --git a/ports/cc3200/mods/pybwdt.c b/ports/cc3200/mods/pybwdt.c
index 3c1f9eb195..589f53cf12 100644
--- a/ports/cc3200/mods/pybwdt.c
+++ b/ports/cc3200/mods/pybwdt.c
@@ -154,7 +154,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_wdt_type,
MP_QSTR_WDT,
MP_TYPE_FLAG_NONE,
- pyb_wdt_make_new,
+ make_new, pyb_wdt_make_new,
locals_dict, &pybwdt_locals_dict
);
diff --git a/ports/esp32/esp32_nvs.c b/ports/esp32/esp32_nvs.c
index d935a13d6f..0b3661918c 100644
--- a/ports/esp32/esp32_nvs.c
+++ b/ports/esp32/esp32_nvs.c
@@ -145,7 +145,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
esp32_nvs_type,
MP_QSTR_NVS,
MP_TYPE_FLAG_NONE,
- esp32_nvs_make_new,
+ make_new, esp32_nvs_make_new,
print, esp32_nvs_print,
locals_dict, &esp32_nvs_locals_dict
);
diff --git a/ports/esp32/esp32_partition.c b/ports/esp32/esp32_partition.c
index 6ce1e90b4c..17aa34e560 100644
--- a/ports/esp32/esp32_partition.c
+++ b/ports/esp32/esp32_partition.c
@@ -288,7 +288,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
esp32_partition_type,
MP_QSTR_Partition,
MP_TYPE_FLAG_NONE,
- esp32_partition_make_new,
+ make_new, esp32_partition_make_new,
print, esp32_partition_print,
locals_dict, &esp32_partition_locals_dict
);
diff --git a/ports/esp32/esp32_rmt.c b/ports/esp32/esp32_rmt.c
index ee09ac5200..78c8c8acee 100644
--- a/ports/esp32/esp32_rmt.c
+++ b/ports/esp32/esp32_rmt.c
@@ -376,7 +376,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
esp32_rmt_type,
MP_QSTR_RMT,
MP_TYPE_FLAG_NONE,
- esp32_rmt_make_new,
+ make_new, esp32_rmt_make_new,
print, esp32_rmt_print,
locals_dict, &esp32_rmt_locals_dict
);
diff --git a/ports/esp32/esp32_ulp.c b/ports/esp32/esp32_ulp.c
index 5030f98067..843bdb2366 100644
--- a/ports/esp32/esp32_ulp.c
+++ b/ports/esp32/esp32_ulp.c
@@ -95,7 +95,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
esp32_ulp_type,
MP_QSTR_ULP,
MP_TYPE_FLAG_NONE,
- esp32_ulp_make_new,
+ make_new, esp32_ulp_make_new,
locals_dict, &esp32_ulp_locals_dict
);
diff --git a/ports/esp32/machine_adc.c b/ports/esp32/machine_adc.c
index c4e04159c0..1e20186b97 100644
--- a/ports/esp32/machine_adc.c
+++ b/ports/esp32/machine_adc.c
@@ -260,7 +260,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_adc_type,
MP_QSTR_ADC,
MP_TYPE_FLAG_NONE,
- madc_make_new,
+ make_new, madc_make_new,
print, madc_print,
locals_dict, &madc_locals_dict
);
diff --git a/ports/esp32/machine_adcblock.c b/ports/esp32/machine_adcblock.c
index ae3244f7fd..afe8fdea40 100644
--- a/ports/esp32/machine_adcblock.c
+++ b/ports/esp32/machine_adcblock.c
@@ -198,7 +198,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_adcblock_type,
MP_QSTR_ADCBlock,
MP_TYPE_FLAG_NONE,
- madcblock_make_new,
+ make_new, madcblock_make_new,
print, madcblock_print,
locals_dict, &madcblock_locals_dict
);
diff --git a/ports/esp32/machine_dac.c b/ports/esp32/machine_dac.c
index fbe33b0344..0e85dc9c9b 100644
--- a/ports/esp32/machine_dac.c
+++ b/ports/esp32/machine_dac.c
@@ -108,7 +108,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_dac_type,
MP_QSTR_DAC,
MP_TYPE_FLAG_NONE,
- mdac_make_new,
+ make_new, mdac_make_new,
print, mdac_print,
locals_dict, &mdac_locals_dict
);
diff --git a/ports/esp32/machine_hw_spi.c b/ports/esp32/machine_hw_spi.c
index 51ea31ac1b..05b1c871cb 100644
--- a/ports/esp32/machine_hw_spi.c
+++ b/ports/esp32/machine_hw_spi.c
@@ -549,7 +549,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hw_spi_type,
MP_QSTR_SPI,
MP_TYPE_FLAG_NONE,
- machine_hw_spi_make_new,
+ make_new, machine_hw_spi_make_new,
print, machine_hw_spi_print,
protocol, &machine_hw_spi_p,
locals_dict, &mp_machine_spi_locals_dict
diff --git a/ports/esp32/machine_i2c.c b/ports/esp32/machine_i2c.c
index 895dc3a398..9244343dcf 100644
--- a/ports/esp32/machine_i2c.c
+++ b/ports/esp32/machine_i2c.c
@@ -196,7 +196,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hw_i2c_type,
MP_QSTR_I2C,
MP_TYPE_FLAG_NONE,
- machine_hw_i2c_make_new,
+ make_new, machine_hw_i2c_make_new,
print, machine_hw_i2c_print,
protocol, &machine_hw_i2c_p,
locals_dict, &mp_machine_i2c_locals_dict
diff --git a/ports/esp32/machine_i2s.c b/ports/esp32/machine_i2s.c
index 6e18394cc5..eecf715498 100644
--- a/ports/esp32/machine_i2s.c
+++ b/ports/esp32/machine_i2s.c
@@ -833,7 +833,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_i2s_type,
MP_QSTR_I2S,
MP_TYPE_FLAG_ITER_IS_STREAM,
- machine_i2s_make_new,
+ make_new, machine_i2s_make_new,
print, machine_i2s_print,
protocol, &i2s_stream_p,
locals_dict, &machine_i2s_locals_dict
diff --git a/ports/esp32/machine_pin.c b/ports/esp32/machine_pin.c
index fd523a38ed..4f6f948d52 100644
--- a/ports/esp32/machine_pin.c
+++ b/ports/esp32/machine_pin.c
@@ -533,7 +533,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_type,
MP_QSTR_Pin,
MP_TYPE_FLAG_NONE,
- mp_pin_make_new,
+ make_new, mp_pin_make_new,
print, machine_pin_print,
call, machine_pin_call,
protocol, &pin_pin_p,
@@ -728,7 +728,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_irq_type,
MP_QSTR_IRQ,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
call, machine_pin_irq_call,
locals_dict, &machine_pin_irq_locals_dict
);
diff --git a/ports/esp32/machine_rtc.c b/ports/esp32/machine_rtc.c
index 19b83703fd..3d620336c9 100644
--- a/ports/esp32/machine_rtc.c
+++ b/ports/esp32/machine_rtc.c
@@ -177,6 +177,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_rtc_type,
MP_QSTR_RTC,
MP_TYPE_FLAG_NONE,
- machine_rtc_make_new,
+ make_new, machine_rtc_make_new,
locals_dict, &machine_rtc_locals_dict
);
diff --git a/ports/esp32/machine_sdcard.c b/ports/esp32/machine_sdcard.c
index 0b6159157d..801a26f378 100644
--- a/ports/esp32/machine_sdcard.c
+++ b/ports/esp32/machine_sdcard.c
@@ -403,7 +403,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_sdcard_type,
MP_QSTR_SDCard,
MP_TYPE_FLAG_NONE,
- machine_sdcard_make_new,
+ make_new, machine_sdcard_make_new,
locals_dict, &machine_sdcard_locals_dict
);
diff --git a/ports/esp32/machine_timer.c b/ports/esp32/machine_timer.c
index 2fd40fa2af..83fe81f6ee 100644
--- a/ports/esp32/machine_timer.c
+++ b/ports/esp32/machine_timer.c
@@ -281,7 +281,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_timer_type,
MP_QSTR_Timer,
MP_TYPE_FLAG_NONE,
- machine_timer_make_new,
+ make_new, machine_timer_make_new,
print, machine_timer_print,
locals_dict, &machine_timer_locals_dict
);
diff --git a/ports/esp32/machine_touchpad.c b/ports/esp32/machine_touchpad.c
index deba818dd1..ad1f6c9474 100644
--- a/ports/esp32/machine_touchpad.c
+++ b/ports/esp32/machine_touchpad.c
@@ -138,7 +138,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_touchpad_type,
MP_QSTR_TouchPad,
MP_TYPE_FLAG_NONE,
- mtp_make_new,
+ make_new, mtp_make_new,
locals_dict, &mtp_locals_dict
);
diff --git a/ports/esp32/machine_uart.c b/ports/esp32/machine_uart.c
index 1f404154fc..4cfa31b71d 100644
--- a/ports/esp32/machine_uart.c
+++ b/ports/esp32/machine_uart.c
@@ -534,7 +534,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_ITER_IS_STREAM,
- machine_uart_make_new,
+ make_new, machine_uart_make_new,
print, machine_uart_print,
protocol, &uart_stream_p,
locals_dict, &machine_uart_locals_dict
diff --git a/ports/esp32/machine_wdt.c b/ports/esp32/machine_wdt.c
index bda9c6975e..4ccf417b60 100644
--- a/ports/esp32/machine_wdt.c
+++ b/ports/esp32/machine_wdt.c
@@ -87,6 +87,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_wdt_type,
MP_QSTR_WDT,
MP_TYPE_FLAG_NONE,
- machine_wdt_make_new,
+ make_new, machine_wdt_make_new,
locals_dict, &machine_wdt_locals_dict
);
diff --git a/ports/esp32/modsocket.c b/ports/esp32/modsocket.c
index e7e6f3c26e..334c5bae33 100644
--- a/ports/esp32/modsocket.c
+++ b/ports/esp32/modsocket.c
@@ -789,7 +789,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
socket_type,
MP_QSTR_socket,
MP_TYPE_FLAG_NONE,
- socket_make_new,
+ make_new, socket_make_new,
protocol, &socket_stream_p,
locals_dict, &socket_locals_dict
);
diff --git a/ports/esp32/network_lan.c b/ports/esp32/network_lan.c
index 3c5aea5fb8..c57d7815d7 100644
--- a/ports/esp32/network_lan.c
+++ b/ports/esp32/network_lan.c
@@ -306,7 +306,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
lan_if_type,
MP_QSTR_LAN,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &lan_if_locals_dict
);
diff --git a/ports/esp32/network_ppp.c b/ports/esp32/network_ppp.c
index df07515c7d..703cdc7889 100644
--- a/ports/esp32/network_ppp.c
+++ b/ports/esp32/network_ppp.c
@@ -282,6 +282,5 @@ MP_DEFINE_CONST_OBJ_TYPE(
ppp_if_type,
MP_QSTR_PPP,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &ppp_if_locals_dict
);
diff --git a/ports/esp32/network_wlan.c b/ports/esp32/network_wlan.c
index 0f1f5de149..f0b458e6dd 100644
--- a/ports/esp32/network_wlan.c
+++ b/ports/esp32/network_wlan.c
@@ -619,7 +619,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
wlan_if_type,
MP_QSTR_WLAN,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &wlan_if_locals_dict
);
diff --git a/ports/esp8266/machine_adc.c b/ports/esp8266/machine_adc.c
index b1e7b38435..f4fd32db9c 100644
--- a/ports/esp8266/machine_adc.c
+++ b/ports/esp8266/machine_adc.c
@@ -93,7 +93,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_adc_type,
MP_QSTR_ADC,
MP_TYPE_FLAG_NONE,
- machine_adc_make_new,
+ make_new, machine_adc_make_new,
print, machine_adc_print,
locals_dict, &machine_adc_locals_dict
);
diff --git a/ports/esp8266/machine_hspi.c b/ports/esp8266/machine_hspi.c
index 3f449a1de9..2edb294ade 100644
--- a/ports/esp8266/machine_hspi.c
+++ b/ports/esp8266/machine_hspi.c
@@ -179,7 +179,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hspi_type,
MP_QSTR_HSPI,
MP_TYPE_FLAG_NONE,
- machine_hspi_make_new,
+ make_new, machine_hspi_make_new,
print, machine_hspi_print,
protocol, &machine_hspi_p,
locals_dict, &mp_machine_spi_locals_dict
diff --git a/ports/esp8266/machine_pin.c b/ports/esp8266/machine_pin.c
index 32ffca873d..ea17728e23 100644
--- a/ports/esp8266/machine_pin.c
+++ b/ports/esp8266/machine_pin.c
@@ -454,7 +454,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_pin_type,
MP_QSTR_Pin,
MP_TYPE_FLAG_NONE,
- mp_pin_make_new,
+ make_new, mp_pin_make_new,
print, pyb_pin_print,
call, pyb_pin_call,
protocol, &pin_pin_p,
@@ -514,7 +514,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
pin_irq_type,
MP_QSTR_IRQ,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
call, pin_irq_call,
locals_dict, &pin_irq_locals_dict
);
diff --git a/ports/esp8266/machine_rtc.c b/ports/esp8266/machine_rtc.c
index cc6b79a031..d8cbb8f824 100644
--- a/ports/esp8266/machine_rtc.c
+++ b/ports/esp8266/machine_rtc.c
@@ -266,6 +266,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_rtc_type,
MP_QSTR_RTC,
MP_TYPE_FLAG_NONE,
- pyb_rtc_make_new,
+ make_new, pyb_rtc_make_new,
locals_dict, &pyb_rtc_locals_dict
);
diff --git a/ports/esp8266/machine_uart.c b/ports/esp8266/machine_uart.c
index af6231c219..873b12b2fa 100644
--- a/ports/esp8266/machine_uart.c
+++ b/ports/esp8266/machine_uart.c
@@ -347,7 +347,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_ITER_IS_STREAM,
- pyb_uart_make_new,
+ make_new, pyb_uart_make_new,
print, pyb_uart_print,
protocol, &uart_stream_p,
locals_dict, &pyb_uart_locals_dict
diff --git a/ports/esp8266/machine_wdt.c b/ports/esp8266/machine_wdt.c
index 26d5c9fa76..39a5d51119 100644
--- a/ports/esp8266/machine_wdt.c
+++ b/ports/esp8266/machine_wdt.c
@@ -73,6 +73,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
esp_wdt_type,
MP_QSTR_WDT,
MP_TYPE_FLAG_NONE,
- machine_wdt_make_new,
+ make_new, machine_wdt_make_new,
locals_dict, &machine_wdt_locals_dict
);
diff --git a/ports/esp8266/main.c b/ports/esp8266/main.c
index ded5e58abf..583540a81c 100644
--- a/ports/esp8266/main.c
+++ b/ports/esp8266/main.c
@@ -68,7 +68,7 @@ STATIC void mp_reset(void) {
mp_obj_t args[2];
args[0] = MP_OBJ_NEW_SMALL_INT(0);
args[1] = MP_OBJ_NEW_SMALL_INT(115200);
- args[0] = pyb_uart_type.make_new(&pyb_uart_type, 2, 0, args);
+ args[0] = MP_OBJ_TYPE_GET_SLOT(&pyb_uart_type, make_new)(&pyb_uart_type, 2, 0, args);
args[1] = MP_OBJ_NEW_SMALL_INT(1);
mp_uos_dupterm_obj.fun.var(2, args);
}
diff --git a/ports/esp8266/modmachine.c b/ports/esp8266/modmachine.c
index eb41e30f66..af46cbbfe7 100644
--- a/ports/esp8266/modmachine.c
+++ b/ports/esp8266/modmachine.c
@@ -341,7 +341,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
esp_timer_type,
MP_QSTR_Timer,
MP_TYPE_FLAG_NONE,
- esp_timer_make_new,
+ make_new, esp_timer_make_new,
print, esp_timer_print,
locals_dict, &esp_timer_locals_dict
);
diff --git a/ports/esp8266/modnetwork.c b/ports/esp8266/modnetwork.c
index 45a5a2be54..ec62528a08 100644
--- a/ports/esp8266/modnetwork.c
+++ b/ports/esp8266/modnetwork.c
@@ -514,7 +514,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
wlan_if_type,
MP_QSTR_WLAN,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &wlan_if_locals_dict
);
diff --git a/ports/mimxrt/machine_adc.c b/ports/mimxrt/machine_adc.c
index 7a19d1225e..d63157d36e 100644
--- a/ports/mimxrt/machine_adc.c
+++ b/ports/mimxrt/machine_adc.c
@@ -121,7 +121,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_adc_type,
MP_QSTR_ADC,
MP_TYPE_FLAG_NONE,
- adc_obj_make_new,
+ make_new, adc_obj_make_new,
print, adc_obj_print,
locals_dict, &adc_locals_dict
);
diff --git a/ports/mimxrt/machine_i2c.c b/ports/mimxrt/machine_i2c.c
index 62dfd8204c..f00ba6b1ba 100644
--- a/ports/mimxrt/machine_i2c.c
+++ b/ports/mimxrt/machine_i2c.c
@@ -201,7 +201,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_i2c_type,
MP_QSTR_I2C,
MP_TYPE_FLAG_NONE,
- machine_i2c_make_new,
+ make_new, machine_i2c_make_new,
print, machine_i2c_print,
protocol, &machine_i2c_p,
locals_dict, &mp_machine_i2c_locals_dict
diff --git a/ports/mimxrt/machine_i2s.c b/ports/mimxrt/machine_i2s.c
index b6c630138b..1733140fb5 100644
--- a/ports/mimxrt/machine_i2s.c
+++ b/ports/mimxrt/machine_i2s.c
@@ -1217,7 +1217,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_i2s_type,
MP_QSTR_I2S,
MP_TYPE_FLAG_ITER_IS_STREAM,
- machine_i2s_make_new,
+ make_new, machine_i2s_make_new,
print, machine_i2s_print,
protocol, &i2s_stream_p,
locals_dict, &machine_i2s_locals_dict
diff --git a/ports/mimxrt/machine_led.c b/ports/mimxrt/machine_led.c
index 9fd98ef710..8dd74b32ba 100644
--- a/ports/mimxrt/machine_led.c
+++ b/ports/mimxrt/machine_led.c
@@ -84,7 +84,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_led_type,
MP_QSTR_LED,
MP_TYPE_FLAG_NONE,
- led_obj_make_new,
+ make_new, led_obj_make_new,
print, led_obj_print,
locals_dict, &led_locals_dict
);
diff --git a/ports/mimxrt/machine_pin.c b/ports/mimxrt/machine_pin.c
index 261e3e4148..836bd8524b 100644
--- a/ports/mimxrt/machine_pin.c
+++ b/ports/mimxrt/machine_pin.c
@@ -62,7 +62,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_cpu_pins_obj_type,
MP_QSTR_cpu,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &machine_pin_cpu_pins_locals_dict
);
@@ -70,7 +69,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_board_pins_obj_type,
MP_QSTR_board,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &machine_pin_board_pins_locals_dict
);
@@ -424,7 +422,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_type,
MP_QSTR_Pin,
MP_TYPE_FLAG_NONE,
- mp_pin_make_new,
+ make_new, mp_pin_make_new,
print, machine_pin_obj_print,
call, machine_pin_obj_call,
protocol, &machine_pin_obj_protocol,
@@ -436,7 +434,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_af_type,
MP_QSTR_PinAF,
MP_TYPE_FLAG_NONE,
- mp_pin_make_new,
+ make_new, mp_pin_make_new,
print, machine_pin_obj_print,
locals_dict, &machine_pin_locals_dict
);
diff --git a/ports/mimxrt/machine_rtc.c b/ports/mimxrt/machine_rtc.c
index 2e1a09dedb..da7a437491 100644
--- a/ports/mimxrt/machine_rtc.c
+++ b/ports/mimxrt/machine_rtc.c
@@ -170,6 +170,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_rtc_type,
MP_QSTR_RTC,
MP_TYPE_FLAG_NONE,
- machine_rtc_make_new,
+ make_new, machine_rtc_make_new,
locals_dict, &machine_rtc_locals_dict
);
diff --git a/ports/mimxrt/machine_sdcard.c b/ports/mimxrt/machine_sdcard.c
index 22f7e7c232..9254faf14a 100644
--- a/ports/mimxrt/machine_sdcard.c
+++ b/ports/mimxrt/machine_sdcard.c
@@ -212,7 +212,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_sdcard_type,
MP_QSTR_SDCard,
MP_TYPE_FLAG_NONE,
- sdcard_obj_make_new,
+ make_new, sdcard_obj_make_new,
locals_dict, &sdcard_locals_dict
);
diff --git a/ports/mimxrt/machine_spi.c b/ports/mimxrt/machine_spi.c
index 93b75e931e..a3a6bb414e 100644
--- a/ports/mimxrt/machine_spi.c
+++ b/ports/mimxrt/machine_spi.c
@@ -255,7 +255,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_spi_type,
MP_QSTR_SPI,
MP_TYPE_FLAG_NONE,
- machine_spi_make_new,
+ make_new, machine_spi_make_new,
print, machine_spi_print,
protocol, &machine_spi_p,
locals_dict, &mp_machine_spi_locals_dict
diff --git a/ports/mimxrt/machine_timer.c b/ports/mimxrt/machine_timer.c
index a6b61982f7..a237272390 100644
--- a/ports/mimxrt/machine_timer.c
+++ b/ports/mimxrt/machine_timer.c
@@ -215,7 +215,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_timer_type,
MP_QSTR_Timer,
MP_TYPE_FLAG_NONE,
- machine_timer_make_new,
+ make_new, machine_timer_make_new,
print, machine_timer_print,
locals_dict, &machine_timer_locals_dict
);
diff --git a/ports/mimxrt/machine_uart.c b/ports/mimxrt/machine_uart.c
index e93d2478f3..a0706c8f4f 100644
--- a/ports/mimxrt/machine_uart.c
+++ b/ports/mimxrt/machine_uart.c
@@ -473,7 +473,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_ITER_IS_STREAM,
- machine_uart_make_new,
+ make_new, machine_uart_make_new,
print, machine_uart_print,
protocol, &uart_stream_p,
locals_dict, &machine_uart_locals_dict
diff --git a/ports/mimxrt/machine_wdt.c b/ports/mimxrt/machine_wdt.c
index e0b5c74b54..f5f14f9ef7 100644
--- a/ports/mimxrt/machine_wdt.c
+++ b/ports/mimxrt/machine_wdt.c
@@ -103,6 +103,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_wdt_type,
MP_QSTR_WDT,
MP_TYPE_FLAG_NONE,
- machine_wdt_make_new,
+ make_new, machine_wdt_make_new,
locals_dict, &machine_wdt_locals_dict
);
diff --git a/ports/mimxrt/mimxrt_flash.c b/ports/mimxrt/mimxrt_flash.c
index bd03c853d5..fd2e7558f9 100644
--- a/ports/mimxrt/mimxrt_flash.c
+++ b/ports/mimxrt/mimxrt_flash.c
@@ -219,6 +219,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mimxrt_flash_type,
MP_QSTR_Flash,
MP_TYPE_FLAG_NONE,
- mimxrt_flash_make_new,
+ make_new, mimxrt_flash_make_new,
locals_dict, &mimxrt_flash_locals_dict
);
diff --git a/ports/mimxrt/network_lan.c b/ports/mimxrt/network_lan.c
index e15894294b..0842cde82d 100644
--- a/ports/mimxrt/network_lan.c
+++ b/ports/mimxrt/network_lan.c
@@ -224,7 +224,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
network_lan_type,
MP_QSTR_LAN,
MP_TYPE_FLAG_NONE,
- network_lan_make_new,
+ make_new, network_lan_make_new,
print, network_lan_print,
locals_dict, &network_lan_locals_dict
);
diff --git a/ports/nrf/boards/microbit/modules/iters.c b/ports/nrf/boards/microbit/modules/iters.c
index 2fe1486691..e6762421eb 100644
--- a/ports/nrf/boards/microbit/modules/iters.c
+++ b/ports/nrf/boards/microbit/modules/iters.c
@@ -47,7 +47,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
microbit_repeat_iterator_type,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
iter, microbit_repeat_iter_next
);
diff --git a/ports/nrf/boards/microbit/modules/microbitdisplay.c b/ports/nrf/boards/microbit/modules/microbitdisplay.c
index 5cb25ea1ce..e4e4d13fe4 100644
--- a/ports/nrf/boards/microbit/modules/microbitdisplay.c
+++ b/ports/nrf/boards/microbit/modules/microbitdisplay.c
@@ -546,7 +546,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
microbit_display_type,
MP_QSTR_MicroBitDisplay,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &microbit_display_locals_dict
);
diff --git a/ports/nrf/boards/microbit/modules/microbitimage.c b/ports/nrf/boards/microbit/modules/microbitimage.c
index b22c2e29ac..17d737dba5 100644
--- a/ports/nrf/boards/microbit/modules/microbitimage.c
+++ b/ports/nrf/boards/microbit/modules/microbitimage.c
@@ -682,7 +682,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
microbit_image_type,
MP_QSTR_MicroBitImage,
MP_TYPE_FLAG_NONE,
- microbit_image_make_new,
+ make_new, microbit_image_make_new,
print, microbit_image_print,
binary_op, image_binary_op,
locals_dict, &microbit_image_locals_dict
@@ -832,7 +832,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
microbit_scrolling_string_iterator_type,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
iter, microbit_scrolling_string_iter_next
);
@@ -912,7 +911,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
microbit_facade_iterator_type,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
iter, microbit_facade_iter_next
);
diff --git a/ports/nrf/main.c b/ports/nrf/main.c
index 83466626fc..bcfaafd39c 100644
--- a/ports/nrf/main.c
+++ b/ports/nrf/main.c
@@ -170,7 +170,7 @@ soft_reset:
MP_OBJ_NEW_SMALL_INT(0),
MP_OBJ_NEW_SMALL_INT(115200),
};
- MP_STATE_PORT(board_stdio_uart) = machine_hard_uart_type.make_new((mp_obj_t)&machine_hard_uart_type, MP_ARRAY_SIZE(args), 0, args);
+ MP_STATE_PORT(board_stdio_uart) = MP_OBJ_TYPE_GET_SLOT(&machine_hard_uart_type, make_new)((mp_obj_t)&machine_hard_uart_type, MP_ARRAY_SIZE(args), 0, args);
}
#endif
diff --git a/ports/nrf/modules/board/led.c b/ports/nrf/modules/board/led.c
index 577c2b6284..57065a4851 100644
--- a/ports/nrf/modules/board/led.c
+++ b/ports/nrf/modules/board/led.c
@@ -198,7 +198,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
board_led_type,
MP_QSTR_LED,
MP_TYPE_FLAG_NONE,
- led_obj_make_new,
+ make_new, led_obj_make_new,
print, led_obj_print,
locals_dict, &led_locals_dict
);
diff --git a/ports/nrf/modules/machine/adc.c b/ports/nrf/modules/machine/adc.c
index 84db8d259f..df9d23465a 100644
--- a/ports/nrf/modules/machine/adc.c
+++ b/ports/nrf/modules/machine/adc.c
@@ -298,7 +298,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_adc_type,
MP_QSTR_ADC,
MP_TYPE_FLAG_NONE,
- machine_adc_make_new,
+ make_new, machine_adc_make_new,
locals_dict, &machine_adc_locals_dict,
print, machine_adc_print
);
diff --git a/ports/nrf/modules/machine/i2c.c b/ports/nrf/modules/machine/i2c.c
index 7cb55d0788..c16c3669ec 100644
--- a/ports/nrf/modules/machine/i2c.c
+++ b/ports/nrf/modules/machine/i2c.c
@@ -165,7 +165,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hard_i2c_type,
MP_QSTR_I2C,
MP_TYPE_FLAG_NONE,
- machine_hard_i2c_make_new,
+ make_new, machine_hard_i2c_make_new,
print, machine_hard_i2c_print,
protocol, &machine_hard_i2c_p,
locals_dict, &mp_machine_i2c_locals_dict
diff --git a/ports/nrf/modules/machine/pin.c b/ports/nrf/modules/machine/pin.c
index 4f283e5dba..db5cc9cbb1 100644
--- a/ports/nrf/modules/machine/pin.c
+++ b/ports/nrf/modules/machine/pin.c
@@ -600,7 +600,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_type,
MP_QSTR_Pin,
MP_TYPE_FLAG_NONE,
- pin_make_new,
+ make_new, pin_make_new,
print, pin_print,
call, pin_call,
locals_dict, &pin_locals_dict
@@ -676,7 +676,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_af_type,
MP_QSTR_PinAF,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, pin_af_obj_print,
locals_dict, &pin_af_locals_dict
);
diff --git a/ports/nrf/modules/machine/pwm.c b/ports/nrf/modules/machine/pwm.c
index 54e643ec55..862e1907cb 100644
--- a/ports/nrf/modules/machine/pwm.c
+++ b/ports/nrf/modules/machine/pwm.c
@@ -343,7 +343,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hard_pwm_type,
MP_QSTR_PWM,
MP_TYPE_FLAG_NONE,
- machine_pwm_make_new,
+ make_new, machine_pwm_make_new,
print, machine_pwm_print,
locals_dict, &machine_pwm_locals_dict
);
diff --git a/ports/nrf/modules/machine/rtcounter.c b/ports/nrf/modules/machine/rtcounter.c
index cafe08b6c6..d52ca3e9a3 100644
--- a/ports/nrf/modules/machine/rtcounter.c
+++ b/ports/nrf/modules/machine/rtcounter.c
@@ -266,7 +266,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_rtcounter_type,
MP_QSTR_RTCounter,
MP_TYPE_FLAG_NONE,
- machine_rtc_make_new,
+ make_new, machine_rtc_make_new,
print, rtc_print,
locals_dict, &machine_rtc_locals_dict
);
diff --git a/ports/nrf/modules/machine/spi.c b/ports/nrf/modules/machine/spi.c
index d5613a4643..fd7f7bb5bc 100644
--- a/ports/nrf/modules/machine/spi.c
+++ b/ports/nrf/modules/machine/spi.c
@@ -431,7 +431,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hard_spi_type,
MP_QSTR_SPI,
MP_TYPE_FLAG_NONE,
- machine_spi_make_new,
+ make_new, machine_spi_make_new,
print, machine_hard_spi_print,
protocol, &machine_hard_spi_p,
locals_dict, &machine_spi_locals_dict
diff --git a/ports/nrf/modules/machine/temp.c b/ports/nrf/modules/machine/temp.c
index 00d6329b64..dff15a9d14 100644
--- a/ports/nrf/modules/machine/temp.c
+++ b/ports/nrf/modules/machine/temp.c
@@ -116,7 +116,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_temp_type,
MP_QSTR_Temp,
MP_TYPE_FLAG_NONE,
- machine_temp_make_new,
+ make_new, machine_temp_make_new,
locals_dict, &machine_temp_locals_dict,
print, machine_temp_print
);
diff --git a/ports/nrf/modules/machine/timer.c b/ports/nrf/modules/machine/timer.c
index f7f6101726..091e6d0e32 100644
--- a/ports/nrf/modules/machine/timer.c
+++ b/ports/nrf/modules/machine/timer.c
@@ -238,7 +238,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_timer_type,
MP_QSTR_Timer,
MP_TYPE_FLAG_NONE,
- machine_timer_make_new,
+ make_new, machine_timer_make_new,
print, timer_print,
locals_dict, &machine_timer_locals_dict
);
diff --git a/ports/nrf/modules/machine/uart.c b/ports/nrf/modules/machine/uart.c
index ca0fcf859a..035a30df9c 100644
--- a/ports/nrf/modules/machine/uart.c
+++ b/ports/nrf/modules/machine/uart.c
@@ -374,7 +374,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hard_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_ITER_IS_STREAM,
- machine_hard_uart_make_new,
+ make_new, machine_hard_uart_make_new,
print, machine_hard_uart_print,
protocol, &uart_stream_p,
locals_dict, &machine_hard_uart_locals_dict
diff --git a/ports/nrf/modules/nrf/flashbdev.c b/ports/nrf/modules/nrf/flashbdev.c
index 84a3dd2520..e92919cac5 100644
--- a/ports/nrf/modules/nrf/flashbdev.c
+++ b/ports/nrf/modules/nrf/flashbdev.c
@@ -187,7 +187,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
nrf_flashbdev_type,
MP_QSTR_Flash,
MP_TYPE_FLAG_NONE,
- nrf_flashbdev_make_new,
+ make_new, nrf_flashbdev_make_new,
print, nrf_flashbdev_print,
locals_dict, &nrf_flashbdev_locals_dict
);
diff --git a/ports/nrf/modules/ubluepy/ubluepy_characteristic.c b/ports/nrf/modules/ubluepy/ubluepy_characteristic.c
index 2be7dab9d3..7b9e3af6a3 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_characteristic.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_characteristic.c
@@ -213,7 +213,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_characteristic_type,
MP_QSTR_Characteristic,
MP_TYPE_FLAG_NONE,
- ubluepy_characteristic_make_new,
+ make_new, ubluepy_characteristic_make_new,
print, ubluepy_characteristic_print,
locals_dict, &ubluepy_characteristic_locals_dict
);
diff --git a/ports/nrf/modules/ubluepy/ubluepy_constants.c b/ports/nrf/modules/ubluepy/ubluepy_constants.c
index c6c3999245..cad9adbb03 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_constants.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_constants.c
@@ -73,7 +73,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_constants_ad_types_type,
MP_QSTR_ad_types,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &ubluepy_constants_ad_types_locals_dict
);
@@ -96,7 +95,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_constants_type,
MP_QSTR_constants,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &ubluepy_constants_locals_dict
);
diff --git a/ports/nrf/modules/ubluepy/ubluepy_delegate.c b/ports/nrf/modules/ubluepy/ubluepy_delegate.c
index dd19f70be4..43720b4186 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_delegate.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_delegate.c
@@ -81,7 +81,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_delegate_type,
MP_QSTR_DefaultDelegate,
MP_TYPE_FLAG_NONE,
- ubluepy_delegate_make_new,
+ make_new, ubluepy_delegate_make_new,
print, ubluepy_delegate_print,
locals_dict, &ubluepy_delegate_locals_dict
);
diff --git a/ports/nrf/modules/ubluepy/ubluepy_descriptor.c b/ports/nrf/modules/ubluepy/ubluepy_descriptor.c
index d942d98223..062b421094 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_descriptor.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_descriptor.c
@@ -74,7 +74,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_descriptor_type,
MP_QSTR_Descriptor,
MP_TYPE_FLAG_NONE,
- ubluepy_descriptor_make_new,
+ make_new, ubluepy_descriptor_make_new,
print, ubluepy_descriptor_print,
locals_dict, &ubluepy_descriptor_locals_dict
);
diff --git a/ports/nrf/modules/ubluepy/ubluepy_peripheral.c b/ports/nrf/modules/ubluepy/ubluepy_peripheral.c
index 9f638b45d7..d2a9e0011d 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_peripheral.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_peripheral.c
@@ -486,7 +486,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_peripheral_type,
MP_QSTR_Peripheral,
MP_TYPE_FLAG_NONE,
- ubluepy_peripheral_make_new,
+ make_new, ubluepy_peripheral_make_new,
print, ubluepy_peripheral_print,
locals_dict, &ubluepy_peripheral_locals_dict
);
diff --git a/ports/nrf/modules/ubluepy/ubluepy_scan_entry.c b/ports/nrf/modules/ubluepy/ubluepy_scan_entry.c
index 89ca65d18c..2dd4f57860 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_scan_entry.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_scan_entry.c
@@ -140,7 +140,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_scan_entry_type,
MP_QSTR_ScanEntry,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, ubluepy_scan_entry_print,
locals_dict, &ubluepy_scan_entry_locals_dict
);
diff --git a/ports/nrf/modules/ubluepy/ubluepy_scanner.c b/ports/nrf/modules/ubluepy/ubluepy_scanner.c
index b56ec349d0..ffb7e94671 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_scanner.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_scanner.c
@@ -118,7 +118,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_scanner_type,
MP_QSTR_Scanner,
MP_TYPE_FLAG_NONE,
- ubluepy_scanner_make_new,
+ make_new, ubluepy_scanner_make_new,
print, ubluepy_scanner_print,
locals_dict, &ubluepy_scanner_locals_dict
);
diff --git a/ports/nrf/modules/ubluepy/ubluepy_service.c b/ports/nrf/modules/ubluepy/ubluepy_service.c
index 2bec6befd6..bf336d04c5 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_service.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_service.c
@@ -175,7 +175,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_service_type,
MP_QSTR_Service,
MP_TYPE_FLAG_NONE,
- ubluepy_service_make_new,
+ make_new, ubluepy_service_make_new,
print, ubluepy_service_print,
locals_dict, &ubluepy_service_locals_dict
);
diff --git a/ports/nrf/modules/ubluepy/ubluepy_uuid.c b/ports/nrf/modules/ubluepy/ubluepy_uuid.c
index 0fd6e75e5b..abfe3cadd5 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_uuid.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_uuid.c
@@ -164,7 +164,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_uuid_type,
MP_QSTR_UUID,
MP_TYPE_FLAG_NONE,
- ubluepy_uuid_make_new,
+ make_new, ubluepy_uuid_make_new,
print, ubluepy_uuid_print,
locals_dict, &ubluepy_uuid_locals_dict
);
diff --git a/ports/nrf/modules/uos/microbitfs.c b/ports/nrf/modules/uos/microbitfs.c
index d1b3201116..6d697e1d1a 100644
--- a/ports/nrf/modules/uos/microbitfs.c
+++ b/ports/nrf/modules/uos/microbitfs.c
@@ -630,7 +630,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
uos_mbfs_textio_type,
MP_QSTR_TextIO,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
protocol, &textio_stream_p,
locals_dict, &uos_mbfs_file_locals_dict
);
@@ -645,7 +644,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
uos_mbfs_fileio_type,
MP_QSTR_FileIO,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
protocol, &fileio_stream_p,
locals_dict, &uos_mbfs_file_locals_dict
);
diff --git a/ports/nrf/pin_named_pins.c b/ports/nrf/pin_named_pins.c
index 84ec89f44a..30e60692f7 100644
--- a/ports/nrf/pin_named_pins.c
+++ b/ports/nrf/pin_named_pins.c
@@ -40,7 +40,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_cpu_pins_obj_type,
MP_QSTR_cpu,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, pin_named_pins_obj_print,
locals_dict, &pin_cpu_pins_locals_dict
);
@@ -49,7 +48,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_board_pins_obj_type,
MP_QSTR_board,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, pin_named_pins_obj_print,
locals_dict, &pin_board_pins_locals_dict
);
diff --git a/ports/pic16bit/modpybled.c b/ports/pic16bit/modpybled.c
index 2e5c2dcca3..47e83e0409 100644
--- a/ports/pic16bit/modpybled.c
+++ b/ports/pic16bit/modpybled.c
@@ -88,7 +88,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_led_type,
MP_QSTR_LED,
MP_TYPE_FLAG_NONE,
- pyb_led_make_new,
+ make_new, pyb_led_make_new,
print, pyb_led_print,
locals_dict, &pyb_led_locals_dict
);
diff --git a/ports/pic16bit/modpybswitch.c b/ports/pic16bit/modpybswitch.c
index f27cfb9b09..b7192c5bba 100644
--- a/ports/pic16bit/modpybswitch.c
+++ b/ports/pic16bit/modpybswitch.c
@@ -75,7 +75,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_switch_type,
MP_QSTR_Switch,
MP_TYPE_FLAG_NONE,
- pyb_switch_make_new,
+ make_new, pyb_switch_make_new,
print, pyb_switch_print,
call, pyb_switch_call,
locals_dict, &pyb_switch_locals_dict
diff --git a/ports/renesas-ra/extint.c b/ports/renesas-ra/extint.c
index 496a50c3e8..915c23e3cd 100644
--- a/ports/renesas-ra/extint.c
+++ b/ports/renesas-ra/extint.c
@@ -378,7 +378,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
extint_type,
MP_QSTR_ExtInt,
MP_TYPE_FLAG_NONE,
- extint_make_new,
+ make_new, extint_make_new,
locals_dict, &extint_locals_dict,
print, extint_obj_print
);
diff --git a/ports/renesas-ra/led.c b/ports/renesas-ra/led.c
index 9a3f1d40e9..a2284c5339 100644
--- a/ports/renesas-ra/led.c
+++ b/ports/renesas-ra/led.c
@@ -174,7 +174,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
ra_led_type,
MP_QSTR_LED,
MP_TYPE_FLAG_NONE,
- led_obj_make_new,
+ make_new, led_obj_make_new,
locals_dict, &led_locals_dict,
print, led_obj_print
);
diff --git a/ports/renesas-ra/machine_adc.c b/ports/renesas-ra/machine_adc.c
index 99e35f48d9..b71c3db4b0 100644
--- a/ports/renesas-ra/machine_adc.c
+++ b/ports/renesas-ra/machine_adc.c
@@ -130,7 +130,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_adc_type,
MP_QSTR_ADC,
MP_TYPE_FLAG_NONE,
- machine_adc_make_new,
+ make_new, machine_adc_make_new,
locals_dict, &machine_adc_locals_dict,
print, machine_adc_print
);
diff --git a/ports/renesas-ra/machine_i2c.c b/ports/renesas-ra/machine_i2c.c
index 563ea8787e..16bd589964 100644
--- a/ports/renesas-ra/machine_i2c.c
+++ b/ports/renesas-ra/machine_i2c.c
@@ -160,7 +160,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_i2c_type,
MP_QSTR_I2C,
MP_TYPE_FLAG_NONE,
- machine_i2c_make_new,
+ make_new, machine_i2c_make_new,
locals_dict, &mp_machine_i2c_locals_dict,
print, machine_i2c_print,
protocol, &machine_i2c_p
diff --git a/ports/renesas-ra/machine_pin.c b/ports/renesas-ra/machine_pin.c
index 17ef1e19a4..0e393b64e5 100644
--- a/ports/renesas-ra/machine_pin.c
+++ b/ports/renesas-ra/machine_pin.c
@@ -353,7 +353,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_type,
MP_QSTR_Pin,
MP_TYPE_FLAG_NONE,
- mp_pin_make_new,
+ make_new, mp_pin_make_new,
locals_dict, &machine_pin_locals_dict,
print, machine_pin_print,
call, machine_pin_call,
@@ -393,7 +393,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_cpu_pins_obj_type,
MP_QSTR_cpu,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &pin_cpu_pins_locals_dict
);
@@ -401,7 +400,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_board_pins_obj_type,
MP_QSTR_board,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &pin_board_pins_locals_dict
);
diff --git a/ports/renesas-ra/machine_rtc.c b/ports/renesas-ra/machine_rtc.c
index c3f64c6971..e699bea0bc 100644
--- a/ports/renesas-ra/machine_rtc.c
+++ b/ports/renesas-ra/machine_rtc.c
@@ -345,6 +345,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_rtc_type,
MP_QSTR_RTC,
MP_TYPE_FLAG_NONE,
- machine_rtc_make_new,
+ make_new, machine_rtc_make_new,
locals_dict, &machine_rtc_locals_dict
);
diff --git a/ports/renesas-ra/machine_spi.c b/ports/renesas-ra/machine_spi.c
index d0e8b03bd1..b9f5b1ad1b 100644
--- a/ports/renesas-ra/machine_spi.c
+++ b/ports/renesas-ra/machine_spi.c
@@ -301,7 +301,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hard_spi_type,
MP_QSTR_SPI,
MP_TYPE_FLAG_NONE,
- machine_hard_spi_make_new,
+ make_new, machine_hard_spi_make_new,
locals_dict, &mp_machine_spi_locals_dict,
print, machine_hard_spi_print,
protocol, &machine_hard_spi_p
diff --git a/ports/renesas-ra/machine_timer.c b/ports/renesas-ra/machine_timer.c
index f3e5aafb7c..0f6ff80d27 100644
--- a/ports/renesas-ra/machine_timer.c
+++ b/ports/renesas-ra/machine_timer.c
@@ -140,7 +140,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_timer_type,
MP_QSTR_Timer,
MP_TYPE_FLAG_NONE,
- machine_timer_make_new,
+ make_new, machine_timer_make_new,
locals_dict, &machine_timer_locals_dict,
print, machine_timer_print
);
diff --git a/ports/renesas-ra/machine_uart.c b/ports/renesas-ra/machine_uart.c
index 6fa84ca821..86505ea0b9 100644
--- a/ports/renesas-ra/machine_uart.c
+++ b/ports/renesas-ra/machine_uart.c
@@ -575,7 +575,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_ITER_IS_STREAM,
- machine_uart_make_new,
+ make_new, machine_uart_make_new,
locals_dict, &machine_uart_locals_dict,
print, machine_uart_print,
protocol, &uart_stream_p
diff --git a/ports/renesas-ra/main.c b/ports/renesas-ra/main.c
index a87ddbd868..d403dbacbe 100644
--- a/ports/renesas-ra/main.c
+++ b/ports/renesas-ra/main.c
@@ -182,7 +182,7 @@ MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) {
if (len != -1) {
// Detected a littlefs filesystem so create correct block device for it
mp_obj_t args[] = { MP_OBJ_NEW_QSTR(MP_QSTR_len), MP_OBJ_NEW_SMALL_INT(len) };
- bdev = pyb_flash_type.make_new(&pyb_flash_type, 0, 1, args);
+ bdev = MP_OBJ_TYPE_GET_SLOT(&pyb_flash_type, make_new)(&pyb_flash_type, 0, 1, args);
}
#endif
diff --git a/ports/renesas-ra/storage.c b/ports/renesas-ra/storage.c
index f573894a50..18dff97800 100644
--- a/ports/renesas-ra/storage.c
+++ b/ports/renesas-ra/storage.c
@@ -404,7 +404,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_flash_type,
MP_QSTR_Flash,
MP_TYPE_FLAG_NONE,
- pyb_flash_make_new,
+ make_new, pyb_flash_make_new,
locals_dict, &pyb_flash_locals_dict,
print, pyb_flash_print
);
diff --git a/ports/renesas-ra/timer.c b/ports/renesas-ra/timer.c
index 8f7acbcdaa..04bd752b98 100644
--- a/ports/renesas-ra/timer.c
+++ b/ports/renesas-ra/timer.c
@@ -414,7 +414,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_type,
MP_QSTR_Timer,
MP_TYPE_FLAG_NONE,
- pyb_timer_make_new,
+ make_new, pyb_timer_make_new,
locals_dict, &pyb_timer_locals_dict,
print, pyb_timer_print
);
@@ -507,7 +507,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_channel_type,
MP_QSTR_TimerChannel,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &pyb_timer_channel_locals_dict,
print, pyb_timer_channel_print
);
diff --git a/ports/renesas-ra/usrsw.c b/ports/renesas-ra/usrsw.c
index 4107d7850d..edbe519683 100644
--- a/ports/renesas-ra/usrsw.c
+++ b/ports/renesas-ra/usrsw.c
@@ -139,7 +139,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_switch_type,
MP_QSTR_Switch,
MP_TYPE_FLAG_NONE,
- pyb_switch_make_new,
+ make_new, pyb_switch_make_new,
locals_dict, &pyb_switch_locals_dict,
print, pyb_switch_print,
call, pyb_switch_call
diff --git a/ports/rp2/machine_adc.c b/ports/rp2/machine_adc.c
index 85562d5c07..9e3d7f57a8 100644
--- a/ports/rp2/machine_adc.c
+++ b/ports/rp2/machine_adc.c
@@ -117,7 +117,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_adc_type,
MP_QSTR_ADC,
MP_TYPE_FLAG_NONE,
- machine_adc_make_new,
+ make_new, machine_adc_make_new,
print, machine_adc_print,
locals_dict, &machine_adc_locals_dict
);
diff --git a/ports/rp2/machine_i2c.c b/ports/rp2/machine_i2c.c
index 5ab93f6358..00dc36a4e0 100644
--- a/ports/rp2/machine_i2c.c
+++ b/ports/rp2/machine_i2c.c
@@ -180,7 +180,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hw_i2c_type,
MP_QSTR_I2C,
MP_TYPE_FLAG_NONE,
- machine_i2c_make_new,
+ make_new, machine_i2c_make_new,
print, machine_i2c_print,
protocol, &machine_i2c_p,
locals_dict, &mp_machine_i2c_locals_dict
diff --git a/ports/rp2/machine_i2s.c b/ports/rp2/machine_i2s.c
index 53ff7417d7..d5175471ae 100644
--- a/ports/rp2/machine_i2s.c
+++ b/ports/rp2/machine_i2s.c
@@ -1141,7 +1141,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_i2s_type,
MP_QSTR_I2S,
MP_TYPE_FLAG_ITER_IS_STREAM,
- machine_i2s_make_new,
+ make_new, machine_i2s_make_new,
print, machine_i2s_print,
protocol, &i2s_stream_p,
locals_dict, &machine_i2s_locals_dict
diff --git a/ports/rp2/machine_pin.c b/ports/rp2/machine_pin.c
index 8ccfbca3ab..9abcf064e7 100644
--- a/ports/rp2/machine_pin.c
+++ b/ports/rp2/machine_pin.c
@@ -645,7 +645,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_type,
MP_QSTR_Pin,
MP_TYPE_FLAG_NONE,
- mp_pin_make_new,
+ make_new, mp_pin_make_new,
print, machine_pin_print,
call, machine_pin_call,
protocol, &pin_pin_p,
diff --git a/ports/rp2/machine_rtc.c b/ports/rp2/machine_rtc.c
index 6b2c9ac71b..a9d3426cf8 100644
--- a/ports/rp2/machine_rtc.c
+++ b/ports/rp2/machine_rtc.c
@@ -119,6 +119,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_rtc_type,
MP_QSTR_RTC,
MP_TYPE_FLAG_NONE,
- machine_rtc_make_new,
+ make_new, machine_rtc_make_new,
locals_dict, &machine_rtc_locals_dict
);
diff --git a/ports/rp2/machine_spi.c b/ports/rp2/machine_spi.c
index 08c79712cf..b2b879c9a8 100644
--- a/ports/rp2/machine_spi.c
+++ b/ports/rp2/machine_spi.c
@@ -294,7 +294,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_spi_type,
MP_QSTR_SPI,
MP_TYPE_FLAG_NONE,
- machine_spi_make_new,
+ make_new, machine_spi_make_new,
print, machine_spi_print,
protocol, &machine_spi_p,
locals_dict, &mp_machine_spi_locals_dict
diff --git a/ports/rp2/machine_timer.c b/ports/rp2/machine_timer.c
index 66f632329c..e4fbb03af4 100644
--- a/ports/rp2/machine_timer.c
+++ b/ports/rp2/machine_timer.c
@@ -160,7 +160,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_timer_type,
MP_QSTR_Timer,
MP_TYPE_FLAG_NONE,
- machine_timer_make_new,
+ make_new, machine_timer_make_new,
print, machine_timer_print,
locals_dict, &machine_timer_locals_dict
);
diff --git a/ports/rp2/machine_uart.c b/ports/rp2/machine_uart.c
index 06f7e9aaac..e4881cd4f1 100644
--- a/ports/rp2/machine_uart.c
+++ b/ports/rp2/machine_uart.c
@@ -583,7 +583,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_ITER_IS_STREAM,
- machine_uart_make_new,
+ make_new, machine_uart_make_new,
print, machine_uart_print,
protocol, &uart_stream_p,
locals_dict, &machine_uart_locals_dict
diff --git a/ports/rp2/machine_wdt.c b/ports/rp2/machine_wdt.c
index c224298d13..6574a6180f 100644
--- a/ports/rp2/machine_wdt.c
+++ b/ports/rp2/machine_wdt.c
@@ -81,6 +81,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_wdt_type,
MP_QSTR_WDT,
MP_TYPE_FLAG_NONE,
- machine_wdt_make_new,
+ make_new, machine_wdt_make_new,
locals_dict, &machine_wdt_locals_dict
);
diff --git a/ports/rp2/mpbthciport.c b/ports/rp2/mpbthciport.c
index e37167a974..8840fe52f1 100644
--- a/ports/rp2/mpbthciport.c
+++ b/ports/rp2/mpbthciport.c
@@ -103,7 +103,7 @@ int mp_bluetooth_hci_uart_init(uint32_t port, uint32_t baudrate) {
// This is a statically-allocated UART (see machine_uart.c), and doesn't
// contain any heap pointers other than the ringbufs (which are already
// root pointers), so no need to track this as a root pointer.
- mp_bthci_uart = machine_uart_type.make_new((mp_obj_t)&machine_uart_type, 2, 2, args);
+ mp_bthci_uart = MP_OBJ_TYPE_GET_SLOT(&machine_uart_type, make_new)((mp_obj_t)&machine_uart_type, 2, 2, args);
// Start the HCI polling to process any initial events/packets.
mp_bluetooth_hci_start_polling();
diff --git a/ports/rp2/rp2_flash.c b/ports/rp2/rp2_flash.c
index df49c881c4..0a94b6cc90 100644
--- a/ports/rp2/rp2_flash.c
+++ b/ports/rp2/rp2_flash.c
@@ -189,6 +189,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
rp2_flash_type,
MP_QSTR_Flash,
MP_TYPE_FLAG_NONE,
- rp2_flash_make_new,
+ make_new, rp2_flash_make_new,
locals_dict, &rp2_flash_locals_dict
);
diff --git a/ports/rp2/rp2_pio.c b/ports/rp2/rp2_pio.c
index cfba9cce5a..87deaf7e5f 100644
--- a/ports/rp2/rp2_pio.c
+++ b/ports/rp2/rp2_pio.c
@@ -380,7 +380,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
rp2_pio_type,
MP_QSTR_PIO,
MP_TYPE_FLAG_NONE,
- rp2_pio_make_new,
+ make_new, rp2_pio_make_new,
print, rp2_pio_print,
locals_dict, &rp2_pio_locals_dict
);
@@ -811,7 +811,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
rp2_state_machine_type,
MP_QSTR_StateMachine,
MP_TYPE_FLAG_NONE,
- rp2_state_machine_make_new,
+ make_new, rp2_state_machine_make_new,
print, rp2_state_machine_print,
locals_dict, &rp2_state_machine_locals_dict
);
diff --git a/ports/samd/machine_led.c b/ports/samd/machine_led.c
index 7a9b2299ae..03b47e7cf2 100644
--- a/ports/samd/machine_led.c
+++ b/ports/samd/machine_led.c
@@ -166,7 +166,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_led_type,
MP_QSTR_LED,
MP_TYPE_FLAG_NONE,
- mp_led_make_new,
+ make_new, mp_led_make_new,
print, machine_led_print,
call, machine_led_call,
locals_dict, &machine_led_locals_dict
diff --git a/ports/samd/machine_pin.c b/ports/samd/machine_pin.c
index 75e1a2356c..5f9cbfb99b 100644
--- a/ports/samd/machine_pin.c
+++ b/ports/samd/machine_pin.c
@@ -291,7 +291,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_type,
MP_QSTR_Pin,
MP_TYPE_FLAG_NONE,
- mp_pin_make_new,
+ make_new, mp_pin_make_new,
print, machine_pin_print,
call, machine_pin_call,
protocol, &pin_pin_p,
diff --git a/ports/samd/samd_flash.c b/ports/samd/samd_flash.c
index 9d64768cfa..522522ef84 100644
--- a/ports/samd/samd_flash.c
+++ b/ports/samd/samd_flash.c
@@ -185,6 +185,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
samd_flash_type,
MP_QSTR_Flash,
MP_TYPE_FLAG_NONE,
- samd_flash_make_new,
+ make_new, samd_flash_make_new,
locals_dict, &samd_flash_locals_dict
);
diff --git a/ports/stm32/accel.c b/ports/stm32/accel.c
index 05fd1898bc..19e16831ea 100644
--- a/ports/stm32/accel.c
+++ b/ports/stm32/accel.c
@@ -285,7 +285,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_accel_type,
MP_QSTR_Accel,
MP_TYPE_FLAG_NONE,
- pyb_accel_make_new,
+ make_new, pyb_accel_make_new,
locals_dict, &pyb_accel_locals_dict
);
diff --git a/ports/stm32/adc.c b/ports/stm32/adc.c
index e0759439d1..712e9b3ade 100644
--- a/ports/stm32/adc.c
+++ b/ports/stm32/adc.c
@@ -707,7 +707,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_adc_type,
MP_QSTR_ADC,
MP_TYPE_FLAG_NONE,
- adc_make_new,
+ make_new, adc_make_new,
print, adc_print,
locals_dict, &adc_locals_dict
);
@@ -916,7 +916,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_adc_all_type,
MP_QSTR_ADCAll,
MP_TYPE_FLAG_NONE,
- adc_all_make_new,
+ make_new, adc_all_make_new,
locals_dict, &adc_all_locals_dict
);
diff --git a/ports/stm32/boards/LEGO_HUB_NO6/cc2564.c b/ports/stm32/boards/LEGO_HUB_NO6/cc2564.c
index 50ba81c57a..6ec20935f0 100644
--- a/ports/stm32/boards/LEGO_HUB_NO6/cc2564.c
+++ b/ports/stm32/boards/LEGO_HUB_NO6/cc2564.c
@@ -63,7 +63,7 @@ int mp_bluetooth_hci_controller_init(void) {
// tim_ch = tim.channel(TIM_CH, pyb.Timer.PWM, pin=btclk)
// tim_ch.pulse_width_percent(50)
mp_obj_t args[6] = { MP_OBJ_NEW_SMALL_INT(CC2564_TIMER_BT_SLOWCLOCK_TIM), MP_OBJ_NEW_QSTR(MP_QSTR_freq), MP_OBJ_NEW_SMALL_INT(32768), MP_OBJ_NULL };
- mp_obj_t tim = pyb_timer_type.make_new(&pyb_timer_type, 1, 1, args);
+ mp_obj_t tim = MP_OBJ_TYPE_GET_SLOT(&pyb_timer_type, make_new)(&pyb_timer_type, 1, 1, args);
mp_load_method(tim, MP_QSTR_channel, args);
args[2] = MP_OBJ_NEW_SMALL_INT(CC2564_TIMER_BT_SLOWCLOCK_TIM_CH);
args[3] = MP_OBJ_NEW_SMALL_INT(0); // CHANNEL_MODE_PWM_NORMAL
diff --git a/ports/stm32/dac.c b/ports/stm32/dac.c
index ac8d76090e..36ef9387f8 100644
--- a/ports/stm32/dac.c
+++ b/ports/stm32/dac.c
@@ -506,7 +506,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_dac_type,
MP_QSTR_DAC,
MP_TYPE_FLAG_NONE,
- pyb_dac_make_new,
+ make_new, pyb_dac_make_new,
print, pyb_dac_print,
locals_dict, &pyb_dac_locals_dict
);
diff --git a/ports/stm32/extint.c b/ports/stm32/extint.c
index 0f28610cc3..ca23261ca7 100644
--- a/ports/stm32/extint.c
+++ b/ports/stm32/extint.c
@@ -663,7 +663,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
extint_type,
MP_QSTR_ExtInt,
MP_TYPE_FLAG_NONE,
- extint_make_new,
+ make_new, extint_make_new,
print, extint_obj_print,
locals_dict, &extint_locals_dict
);
diff --git a/ports/stm32/lcd.c b/ports/stm32/lcd.c
index 5017a68fe5..e5d7f30efb 100644
--- a/ports/stm32/lcd.c
+++ b/ports/stm32/lcd.c
@@ -529,7 +529,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_lcd_type,
MP_QSTR_LCD,
MP_TYPE_FLAG_NONE,
- pyb_lcd_make_new,
+ make_new, pyb_lcd_make_new,
locals_dict, &pyb_lcd_locals_dict
);
diff --git a/ports/stm32/led.c b/ports/stm32/led.c
index 6e3229ab32..fa211f1e14 100644
--- a/ports/stm32/led.c
+++ b/ports/stm32/led.c
@@ -385,7 +385,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_led_type,
MP_QSTR_LED,
MP_TYPE_FLAG_NONE,
- led_obj_make_new,
+ make_new, led_obj_make_new,
print, led_obj_print,
locals_dict, &led_locals_dict
);
diff --git a/ports/stm32/machine_adc.c b/ports/stm32/machine_adc.c
index 3659073d06..000b478f86 100644
--- a/ports/stm32/machine_adc.c
+++ b/ports/stm32/machine_adc.c
@@ -496,7 +496,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_adc_type,
MP_QSTR_ADC,
MP_TYPE_FLAG_NONE,
- machine_adc_make_new,
+ make_new, machine_adc_make_new,
print, machine_adc_print,
locals_dict, &machine_adc_locals_dict
);
diff --git a/ports/stm32/machine_i2c.c b/ports/stm32/machine_i2c.c
index 7927daac1b..9a2d338f54 100644
--- a/ports/stm32/machine_i2c.c
+++ b/ports/stm32/machine_i2c.c
@@ -240,7 +240,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hard_i2c_type,
MP_QSTR_I2C,
MP_TYPE_FLAG_NONE,
- machine_hard_i2c_make_new,
+ make_new, machine_hard_i2c_make_new,
print, machine_hard_i2c_print,
protocol, &machine_hard_i2c_p,
locals_dict, &mp_machine_i2c_locals_dict
diff --git a/ports/stm32/machine_i2s.c b/ports/stm32/machine_i2s.c
index d68648bc34..83ac6bc124 100644
--- a/ports/stm32/machine_i2s.c
+++ b/ports/stm32/machine_i2s.c
@@ -1118,7 +1118,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_i2s_type,
MP_QSTR_I2S,
MP_TYPE_FLAG_ITER_IS_STREAM,
- machine_i2s_make_new,
+ make_new, machine_i2s_make_new,
print, machine_i2s_print,
protocol, &i2s_stream_p,
locals_dict, &machine_i2s_locals_dict
diff --git a/ports/stm32/machine_spi.c b/ports/stm32/machine_spi.c
index d64ff2af8f..718ae1af5e 100644
--- a/ports/stm32/machine_spi.c
+++ b/ports/stm32/machine_spi.c
@@ -139,7 +139,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hard_spi_type,
MP_QSTR_SPI,
MP_TYPE_FLAG_NONE,
- machine_hard_spi_make_new,
+ make_new, machine_hard_spi_make_new,
print, machine_hard_spi_print,
protocol, &machine_hard_spi_p,
locals_dict, &mp_machine_spi_locals_dict
diff --git a/ports/stm32/machine_timer.c b/ports/stm32/machine_timer.c
index 2e0120ea81..640d1d200f 100644
--- a/ports/stm32/machine_timer.c
+++ b/ports/stm32/machine_timer.c
@@ -140,7 +140,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_timer_type,
MP_QSTR_Timer,
MP_TYPE_FLAG_NONE,
- machine_timer_make_new,
+ make_new, machine_timer_make_new,
print, machine_timer_print,
locals_dict, &machine_timer_locals_dict
);
diff --git a/ports/stm32/machine_uart.c b/ports/stm32/machine_uart.c
index 4ccff8c136..bb35bac5cc 100644
--- a/ports/stm32/machine_uart.c
+++ b/ports/stm32/machine_uart.c
@@ -664,7 +664,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_ITER_IS_STREAM,
- pyb_uart_make_new,
+ make_new, pyb_uart_make_new,
print, pyb_uart_print,
protocol, &uart_stream_p,
locals_dict, &pyb_uart_locals_dict
diff --git a/ports/stm32/main.c b/ports/stm32/main.c
index c001234704..7f864a018c 100644
--- a/ports/stm32/main.c
+++ b/ports/stm32/main.c
@@ -182,7 +182,7 @@ MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) {
if (len != -1) {
// Detected a littlefs filesystem so create correct block device for it
mp_obj_t args[] = { MP_OBJ_NEW_QSTR(MP_QSTR_len), MP_OBJ_NEW_SMALL_INT(len) };
- bdev = pyb_flash_type.make_new(&pyb_flash_type, 0, 1, args);
+ bdev = MP_OBJ_TYPE_GET_SLOT(&pyb_flash_type, make_new)(&pyb_flash_type, 0, 1, args);
}
#endif
diff --git a/ports/stm32/network_lan.c b/ports/stm32/network_lan.c
index 25a9555088..556adebd8f 100644
--- a/ports/stm32/network_lan.c
+++ b/ports/stm32/network_lan.c
@@ -162,7 +162,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
network_lan_type,
MP_QSTR_LAN,
MP_TYPE_FLAG_NONE,
- network_lan_make_new,
+ make_new, network_lan_make_new,
print, network_lan_print,
locals_dict, &network_lan_locals_dict
);
diff --git a/ports/stm32/pin.c b/ports/stm32/pin.c
index 3c3cde0265..0e4a7e9938 100644
--- a/ports/stm32/pin.c
+++ b/ports/stm32/pin.c
@@ -596,7 +596,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_type,
MP_QSTR_Pin,
MP_TYPE_FLAG_NONE,
- mp_pin_make_new,
+ make_new, mp_pin_make_new,
print, pin_print,
call, pin_call,
protocol, &pin_pin_p,
@@ -674,7 +674,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_af_type,
MP_QSTR_PinAF,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, pin_af_obj_print,
locals_dict, &pin_af_locals_dict
);
diff --git a/ports/stm32/pin_named_pins.c b/ports/stm32/pin_named_pins.c
index 1a35ec5787..8eeb4ed32b 100644
--- a/ports/stm32/pin_named_pins.c
+++ b/ports/stm32/pin_named_pins.c
@@ -35,7 +35,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_cpu_pins_obj_type,
MP_QSTR_cpu,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &pin_cpu_pins_locals_dict
);
@@ -43,7 +42,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pin_board_pins_obj_type,
MP_QSTR_board,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &pin_board_pins_locals_dict
);
diff --git a/ports/stm32/pyb_can.c b/ports/stm32/pyb_can.c
index a07fc92164..69e807c79d 100644
--- a/ports/stm32/pyb_can.c
+++ b/ports/stm32/pyb_can.c
@@ -1076,7 +1076,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_can_type,
MP_QSTR_CAN,
MP_TYPE_FLAG_NONE,
- pyb_can_make_new,
+ make_new, pyb_can_make_new,
print, pyb_can_print,
protocol, &can_stream_p,
locals_dict, &pyb_can_locals_dict
diff --git a/ports/stm32/pyb_i2c.c b/ports/stm32/pyb_i2c.c
index 9071d92944..0cbb640473 100644
--- a/ports/stm32/pyb_i2c.c
+++ b/ports/stm32/pyb_i2c.c
@@ -1108,7 +1108,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_i2c_type,
MP_QSTR_I2C,
MP_TYPE_FLAG_NONE,
- pyb_i2c_make_new,
+ make_new, pyb_i2c_make_new,
print, pyb_i2c_print,
locals_dict, &pyb_i2c_locals_dict
);
diff --git a/ports/stm32/pyb_spi.c b/ports/stm32/pyb_spi.c
index a225bd84e7..54582f8e54 100644
--- a/ports/stm32/pyb_spi.c
+++ b/ports/stm32/pyb_spi.c
@@ -354,7 +354,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_spi_type,
MP_QSTR_SPI,
MP_TYPE_FLAG_NONE,
- pyb_spi_make_new,
+ make_new, pyb_spi_make_new,
print, pyb_spi_print,
protocol, &pyb_spi_p,
locals_dict, &pyb_spi_locals_dict
diff --git a/ports/stm32/rtc.c b/ports/stm32/rtc.c
index f501ec23b1..aacfc3805e 100644
--- a/ports/stm32/rtc.c
+++ b/ports/stm32/rtc.c
@@ -841,6 +841,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_rtc_type,
MP_QSTR_RTC,
MP_TYPE_FLAG_NONE,
- pyb_rtc_make_new,
+ make_new, pyb_rtc_make_new,
locals_dict, &pyb_rtc_locals_dict
);
diff --git a/ports/stm32/sdcard.c b/ports/stm32/sdcard.c
index cbf1ade5c5..964ed49a67 100644
--- a/ports/stm32/sdcard.c
+++ b/ports/stm32/sdcard.c
@@ -876,7 +876,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_sdcard_type,
MP_QSTR_SDCard,
MP_TYPE_FLAG_NONE,
- pyb_sdcard_make_new,
+ make_new, pyb_sdcard_make_new,
locals_dict, &pyb_sdcard_locals_dict
);
#endif
@@ -886,7 +886,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_mmcard_type,
MP_QSTR_MMCard,
MP_TYPE_FLAG_NONE,
- pyb_mmcard_make_new,
+ make_new, pyb_mmcard_make_new,
locals_dict, &pyb_sdcard_locals_dict
);
#endif
diff --git a/ports/stm32/servo.c b/ports/stm32/servo.c
index 1b0ca0a882..e0aa2d6b69 100644
--- a/ports/stm32/servo.c
+++ b/ports/stm32/servo.c
@@ -340,7 +340,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_servo_type,
MP_QSTR_Servo,
MP_TYPE_FLAG_NONE,
- pyb_servo_make_new,
+ make_new, pyb_servo_make_new,
print, pyb_servo_print,
locals_dict, &pyb_servo_locals_dict
);
diff --git a/ports/stm32/storage.c b/ports/stm32/storage.c
index a0154408dd..848602a787 100644
--- a/ports/stm32/storage.c
+++ b/ports/stm32/storage.c
@@ -457,7 +457,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_flash_type,
MP_QSTR_Flash,
MP_TYPE_FLAG_NONE,
- pyb_flash_make_new,
+ make_new, pyb_flash_make_new,
print, pyb_flash_print,
locals_dict, &pyb_flash_locals_dict
);
diff --git a/ports/stm32/timer.c b/ports/stm32/timer.c
index 91c88df1b3..7a6ccd4dfd 100644
--- a/ports/stm32/timer.c
+++ b/ports/stm32/timer.c
@@ -1475,7 +1475,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_type,
MP_QSTR_Timer,
MP_TYPE_FLAG_NONE,
- pyb_timer_make_new,
+ make_new, pyb_timer_make_new,
print, pyb_timer_print,
locals_dict, &pyb_timer_locals_dict
);
@@ -1615,7 +1615,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_channel_type,
MP_QSTR_TimerChannel,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, pyb_timer_channel_print,
locals_dict, &pyb_timer_channel_locals_dict
);
diff --git a/ports/stm32/usb.c b/ports/stm32/usb.c
index e389ef68f2..12c5e497de 100644
--- a/ports/stm32/usb.c
+++ b/ports/stm32/usb.c
@@ -940,7 +940,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_usb_vcp_type,
MP_QSTR_USB_VCP,
MP_TYPE_FLAG_ITER_IS_STREAM,
- pyb_usb_vcp_make_new,
+ make_new, pyb_usb_vcp_make_new,
print, pyb_usb_vcp_print,
protocol, &pyb_usb_vcp_stream_p,
locals_dict, &pyb_usb_vcp_locals_dict
@@ -1080,7 +1080,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_usb_hid_type,
MP_QSTR_USB_HID,
MP_TYPE_FLAG_NONE,
- pyb_usb_hid_make_new,
+ make_new, pyb_usb_hid_make_new,
protocol, &pyb_usb_hid_stream_p,
locals_dict, &pyb_usb_hid_locals_dict
);
diff --git a/ports/stm32/usrsw.c b/ports/stm32/usrsw.c
index 7d406c0ecd..170c01bd6d 100644
--- a/ports/stm32/usrsw.c
+++ b/ports/stm32/usrsw.c
@@ -138,7 +138,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_switch_type,
MP_QSTR_Switch,
MP_TYPE_FLAG_NONE,
- pyb_switch_make_new,
+ make_new, pyb_switch_make_new,
print, pyb_switch_print,
call, pyb_switch_call,
locals_dict, &pyb_switch_locals_dict
diff --git a/ports/stm32/wdt.c b/ports/stm32/wdt.c
index 09780ea9d3..e541e4d36b 100644
--- a/ports/stm32/wdt.c
+++ b/ports/stm32/wdt.c
@@ -106,6 +106,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_wdt_type,
MP_QSTR_WDT,
MP_TYPE_FLAG_NONE,
- pyb_wdt_make_new,
+ make_new, pyb_wdt_make_new,
locals_dict, &pyb_wdt_locals_dict
);
diff --git a/ports/teensy/led.c b/ports/teensy/led.c
index dd4c65da39..46c6ae492f 100644
--- a/ports/teensy/led.c
+++ b/ports/teensy/led.c
@@ -138,7 +138,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_led_type,
MP_QSTR_LED,
MP_TYPE_FLAG_NONE,
- led_obj_make_new,
+ make_new, led_obj_make_new,
print, led_obj_print,
locals_dict, &led_locals_dict
);
diff --git a/ports/teensy/timer.c b/ports/teensy/timer.c
index a0f490d925..8c7609e447 100644
--- a/ports/teensy/timer.c
+++ b/ports/teensy/timer.c
@@ -750,7 +750,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_type,
MP_QSTR_Timer,
MP_TYPE_FLAG_NONE,
- pyb_timer_make_new,
+ make_new, pyb_timer_make_new,
print, pyb_timer_print,
locals_dict, &pyb_timer_locals_dict
);
@@ -894,7 +894,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_channel_type,
MP_QSTR_TimerChannel,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, pyb_timer_channel_print,
locals_dict, &pyb_timer_channel_locals_dict
);
diff --git a/ports/teensy/uart.c b/ports/teensy/uart.c
index db5b8e2f44..e71f676d0a 100644
--- a/ports/teensy/uart.c
+++ b/ports/teensy/uart.c
@@ -487,7 +487,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
pyb_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_NONE,
- pyb_uart_make_new,
+ make_new, pyb_uart_make_new,
print, pyb_uart_print,
locals_dict, &pyb_uart_locals_dict
);
diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c
index 7b4c0c0bf4..8b7fc7de67 100644
--- a/ports/unix/coverage.c
+++ b/ports/unix/coverage.c
@@ -110,7 +110,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_stest_fileio,
MP_QSTR_stest_fileio,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
protocol, &fileio_stream_p,
locals_dict, &rawfile_locals_dict
);
@@ -140,7 +139,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_stest_textio2,
MP_QSTR_stest_textio2,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
protocol, &textio_stream_p2,
locals_dict, &rawfile_locals_dict2
);
diff --git a/ports/unix/main.c b/ports/unix/main.c
index 4f019b6c2c..44823ee174 100644
--- a/ports/unix/main.c
+++ b/ports/unix/main.c
@@ -518,7 +518,7 @@ MP_NOINLINE int main_(int argc, char **argv) {
{
// Mount the host FS at the root of our internal VFS
mp_obj_t args[2] = {
- mp_type_vfs_posix.make_new(&mp_type_vfs_posix, 0, 0, NULL),
+ MP_OBJ_TYPE_GET_SLOT(&mp_type_vfs_posix, make_new)(&mp_type_vfs_posix, 0, 0, NULL),
MP_OBJ_NEW_QSTR(MP_QSTR__slash_),
};
mp_vfs_mount(2, args, (mp_map_t *)&mp_const_empty_map);
diff --git a/ports/unix/modffi.c b/ports/unix/modffi.c
index 04152f1ad4..3df748b80d 100644
--- a/ports/unix/modffi.c
+++ b/ports/unix/modffi.c
@@ -425,7 +425,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
ffimod_type,
MP_QSTR_ffimod,
MP_TYPE_FLAG_NONE,
- ffimod_make_new,
+ make_new, ffimod_make_new,
print, ffimod_print,
locals_dict, &ffimod_locals_dict
);
@@ -535,7 +535,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
ffifunc_type,
MP_QSTR_ffifunc,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, ffifunc_print,
call, ffifunc_call
);
@@ -563,7 +562,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
fficallback_type,
MP_QSTR_fficallback,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, fficallback_print,
locals_dict, &fficallback_locals_dict
);
@@ -601,7 +599,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
ffivar_type,
MP_QSTR_ffivar,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, ffivar_print,
locals_dict, &ffivar_locals_dict
);
@@ -613,8 +610,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
opaque_type,
MP_QSTR_opaqueval,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
- // .print = opaque_print,
+ make_new, // .print = opaque_print,
);
*/
diff --git a/ports/unix/modjni.c b/ports/unix/modjni.c
index e6b874b235..5988876f88 100644
--- a/ports/unix/modjni.c
+++ b/ports/unix/modjni.c
@@ -178,7 +178,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
jclass_type,
MP_QSTR_jclass,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, jclass_print,
attr, jclass_attr,
call, jclass_call,
@@ -326,7 +325,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
jobject_type,
MP_QSTR_jobject,
MP_TYPE_FLAG_ITER_IS_GETITER,
- MP_TYPE_NULL_MAKE_NEW,
print, jobject_print,
unary_op, jobject_unary_op,
attr, jobject_attr,
@@ -575,7 +573,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
jmethod_type,
MP_QSTR_jmethod,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, jmethod_print,
call, jmethod_call,
// .attr = jobject_attr,
diff --git a/ports/unix/moduselect.c b/ports/unix/moduselect.c
index 674841bf18..8f71813e70 100644
--- a/ports/unix/moduselect.c
+++ b/ports/unix/moduselect.c
@@ -315,7 +315,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_poll,
MP_QSTR_poll,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
iter, poll_iternext,
locals_dict, &poll_locals_dict
);
diff --git a/ports/unix/modusocket.c b/ports/unix/modusocket.c
index dfbf15cd3e..a32fc60163 100644
--- a/ports/unix/modusocket.c
+++ b/ports/unix/modusocket.c
@@ -520,7 +520,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_socket,
MP_QSTR_socket,
MP_TYPE_FLAG_NONE,
- socket_make_new,
+ make_new, socket_make_new,
print, socket_print,
protocol, &usocket_stream_p,
locals_dict, &usocket_locals_dict
diff --git a/ports/zephyr/machine_i2c.c b/ports/zephyr/machine_i2c.c
index a844eceb50..8f0f25257b 100644
--- a/ports/zephyr/machine_i2c.c
+++ b/ports/zephyr/machine_i2c.c
@@ -130,7 +130,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hard_i2c_type,
MP_QSTR_I2C,
MP_TYPE_FLAG_NONE,
- machine_hard_i2c_make_new,
+ make_new, machine_hard_i2c_make_new,
print, machine_hard_i2c_print,
protocol, &machine_hard_i2c_p,
locals_dict, &mp_machine_i2c_locals_dict
diff --git a/ports/zephyr/machine_pin.c b/ports/zephyr/machine_pin.c
index 3114ac36fd..be0698651b 100644
--- a/ports/zephyr/machine_pin.c
+++ b/ports/zephyr/machine_pin.c
@@ -289,7 +289,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_type,
MP_QSTR_Pin,
MP_TYPE_FLAG_NONE,
- mp_pin_make_new,
+ make_new, mp_pin_make_new,
print, machine_pin_print,
call, machine_pin_call,
protocol, &machine_pin_pin_p,
diff --git a/ports/zephyr/machine_spi.c b/ports/zephyr/machine_spi.c
index d990ed9c15..19d4ae6dee 100644
--- a/ports/zephyr/machine_spi.c
+++ b/ports/zephyr/machine_spi.c
@@ -201,7 +201,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_hard_spi_type,
MP_QSTR_SPI,
MP_TYPE_FLAG_NONE,
- machine_hard_spi_make_new,
+ make_new, machine_hard_spi_make_new,
print, machine_hard_spi_print,
protocol, &machine_hard_spi_p,
locals_dict, &mp_machine_spi_locals_dict
diff --git a/ports/zephyr/machine_uart.c b/ports/zephyr/machine_uart.c
index 867c5ae886..b989c0f481 100644
--- a/ports/zephyr/machine_uart.c
+++ b/ports/zephyr/machine_uart.c
@@ -158,7 +158,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
machine_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_ITER_IS_STREAM,
- machine_uart_make_new,
+ make_new, machine_uart_make_new,
print, machine_uart_print,
protocol, &uart_stream_p,
locals_dict, &machine_uart_locals_dict
diff --git a/ports/zephyr/main.c b/ports/zephyr/main.c
index c638f38920..869449e7df 100644
--- a/ports/zephyr/main.c
+++ b/ports/zephyr/main.c
@@ -104,11 +104,11 @@ STATIC void vfs_init(void) {
#ifdef CONFIG_DISK_DRIVER_SDMMC
mp_obj_t args[] = { mp_obj_new_str(CONFIG_SDMMC_VOLUME_NAME, strlen(CONFIG_SDMMC_VOLUME_NAME)) };
- bdev = zephyr_disk_access_type.make_new(&zephyr_disk_access_type, ARRAY_SIZE(args), 0, args);
+ bdev = MP_OBJ_TYPE_GET_SLOT(&zephyr_disk_access_type, make_new)(&zephyr_disk_access_type, ARRAY_SIZE(args), 0, args);
mount_point_str = "/sd";
#elif defined(CONFIG_FLASH_MAP) && FLASH_AREA_LABEL_EXISTS(storage)
mp_obj_t args[] = { MP_OBJ_NEW_SMALL_INT(FLASH_AREA_ID(storage)), MP_OBJ_NEW_SMALL_INT(4096) };
- bdev = zephyr_flash_area_type.make_new(&zephyr_flash_area_type, ARRAY_SIZE(args), 0, args);
+ bdev = MP_OBJ_TYPE_GET_SLOT(&zephyr_flash_area_type, make_new)(&zephyr_flash_area_type, ARRAY_SIZE(args), 0, args);
mount_point_str = "/flash";
#endif
diff --git a/ports/zephyr/modusocket.c b/ports/zephyr/modusocket.c
index 77f839fdd5..c79f73a9d2 100644
--- a/ports/zephyr/modusocket.c
+++ b/ports/zephyr/modusocket.c
@@ -357,7 +357,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
socket_type,
MP_QSTR_socket,
MP_TYPE_FLAG_NONE,
- socket_make_new,
+ make_new, socket_make_new,
print, socket_print,
protocol, &socket_stream_p,
locals_dict, &socket_locals_dict
diff --git a/ports/zephyr/modzsensor.c b/ports/zephyr/modzsensor.c
index beb4d6ad79..e35a1716f4 100644
--- a/ports/zephyr/modzsensor.c
+++ b/ports/zephyr/modzsensor.c
@@ -109,7 +109,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
sensor_type,
MP_QSTR_Sensor,
MP_TYPE_FLAG_NONE,
- sensor_make_new,
+ make_new, sensor_make_new,
locals_dict, &sensor_locals_dict
);
diff --git a/ports/zephyr/zephyr_storage.c b/ports/zephyr/zephyr_storage.c
index 6ab8271d34..498fea6fb1 100644
--- a/ports/zephyr/zephyr_storage.c
+++ b/ports/zephyr/zephyr_storage.c
@@ -132,7 +132,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
zephyr_disk_access_type,
MP_QSTR_DiskAccess,
MP_TYPE_FLAG_NONE,
- zephyr_disk_access_make_new,
+ make_new, zephyr_disk_access_make_new,
print, zephyr_disk_access_print,
locals_dict, &zephyr_disk_access_locals_dict
);
@@ -254,7 +254,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
zephyr_flash_area_type,
MP_QSTR_FlashArea,
MP_TYPE_FLAG_NONE,
- zephyr_flash_area_make_new,
+ make_new, zephyr_flash_area_make_new,
print, zephyr_flash_area_print,
locals_dict, &zephyr_flash_area_locals_dict
);
diff --git a/py/builtinevex.c b/py/builtinevex.c
index 403cd95a9d..173978ef52 100644
--- a/py/builtinevex.c
+++ b/py/builtinevex.c
@@ -41,8 +41,7 @@ typedef struct _mp_obj_code_t {
STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_code,
MP_QSTR_code,
- MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW
+ MP_TYPE_FLAG_NONE
);
STATIC mp_obj_t code_execute(mp_obj_code_t *self, mp_obj_dict_t *globals, mp_obj_dict_t *locals) {
diff --git a/py/dynruntime.h b/py/dynruntime.h
index be573bde2a..8564715c0b 100644
--- a/py/dynruntime.h
+++ b/py/dynruntime.h
@@ -105,7 +105,7 @@ static inline void *m_realloc_dyn(void *ptr, size_t new_num_bytes) {
#define mp_const_none ((mp_obj_t)mp_fun_table.const_none)
#define mp_const_false ((mp_obj_t)mp_fun_table.const_false)
#define mp_const_true ((mp_obj_t)mp_fun_table.const_true)
-#define mp_const_empty_bytes (mp_type_bytes.make_new(NULL, 0, 0, NULL))
+#define mp_const_empty_bytes (MP_OBJ_TYPE_GET_SLOT(&mp_type_bytes, make_new)(NULL, 0, 0, NULL))
#define mp_const_empty_tuple (mp_fun_table.new_tuple(0, NULL))
#define mp_obj_new_bool(b) ((b) ? (mp_obj_t)mp_fun_table.const_true : (mp_obj_t)mp_fun_table.const_false)
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index 152323b5ca..06e9f1acb5 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -547,7 +547,7 @@ STATIC mp_obj_t mp_builtin_sorted(size_t n_args, const mp_obj_t *args, mp_map_t
if (n_args > 1) {
mp_raise_TypeError(MP_ERROR_TEXT("must use keyword argument for key function"));
}
- mp_obj_t self = mp_type_list.make_new(&mp_type_list, 1, 0, args);
+ mp_obj_t self = mp_obj_list_make_new(&mp_type_list, 1, 0, args);
mp_obj_list_sort(1, &self, kwargs);
return self;
diff --git a/py/modio.c b/py/modio.c
index a1e04e4cac..9ec6bbcc4e 100644
--- a/py/modio.c
+++ b/py/modio.c
@@ -101,7 +101,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_iobase,
MP_QSTR_IOBase,
MP_TYPE_FLAG_NONE,
- iobase_make_new,
+ make_new, iobase_make_new,
protocol, &iobase_p
);
@@ -196,7 +196,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_bufwriter,
MP_QSTR_BufferedWriter,
MP_TYPE_FLAG_NONE,
- bufwriter_make_new,
+ make_new, bufwriter_make_new,
protocol, &bufwriter_stream_p,
locals_dict, &bufwriter_locals_dict
);
diff --git a/py/modthread.c b/py/modthread.c
index 3116fe6bd9..51d63e4703 100644
--- a/py/modthread.c
+++ b/py/modthread.c
@@ -120,7 +120,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_thread_lock,
MP_QSTR_lock,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
locals_dict, &thread_lock_locals_dict
);
diff --git a/py/obj.h b/py/obj.h
index b1d722080c..34adfbd0f0 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -594,15 +594,15 @@ struct _mp_obj_type_t {
// The name of this type, a qstr.
uint16_t name;
- // Corresponds to __new__ and __init__ special methods, to make an instance of the type.
- mp_make_new_fun_t make_new;
-
// Slots: For the rest of the fields, the slot index points to the
// relevant function in the variable-length "slots" field. Ideally these
// would be only 4 bits, but the extra overhead of accessing them adds
// more code, and we also need to be able to take the address of them for
// mp_obj_class_lookup.
+ // Corresponds to __new__ and __init__ special methods, to make an instance of the type.
+ uint8_t slot_index_make_new;
+
// Corresponds to __repr__ and __str__ special methods.
uint8_t slot_index_print;
@@ -673,8 +673,8 @@ typedef struct _mp_obj_empty_type_t {
mp_obj_base_t base;
uint16_t flags;
uint16_t name;
- mp_make_new_fun_t make_new;
+ uint8_t slot_index_make_new;
uint8_t slot_index_print;
uint8_t slot_index_call;
uint8_t slot_index_unary_op;
@@ -694,8 +694,8 @@ typedef struct _mp_obj_full_type_t {
mp_obj_base_t base;
uint16_t flags;
uint16_t name;
- mp_make_new_fun_t make_new;
+ uint8_t slot_index_make_new;
uint8_t slot_index_print;
uint8_t slot_index_call;
uint8_t slot_index_unary_op;
@@ -712,8 +712,7 @@ typedef struct _mp_obj_full_type_t {
const void *slots[11];
} mp_obj_full_type_t;
-#define MP_TYPE_NULL_MAKE_NEW (NULL)
-
+#define _MP_OBJ_TYPE_SLOT_TYPE_make_new (mp_make_new_fun_t)
#define _MP_OBJ_TYPE_SLOT_TYPE_print (mp_print_fun_t)
#define _MP_OBJ_TYPE_SLOT_TYPE_call (mp_call_fun_t)
#define _MP_OBJ_TYPE_SLOT_TYPE_unary_op (mp_unary_op_fun_t)
@@ -730,42 +729,41 @@ typedef struct _mp_obj_full_type_t {
// Do not use these directly, instead use MP_DEFINE_CONST_OBJ_TYPE.
// Generated with:
// for i in range(13):
-// print(f"#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_{i}(_struct_type, _typename, _name, _flags, _make_new{''.join(f', f{j+1}, v{j+1}' for j in range(i))}) const _struct_type _typename = {{ .base = {{ &mp_type_type }}, .name = _name, .flags = _flags, .make_new = _make_new{''.join(f', .slot_index_##f{j+1} = {j+1}' for j in range(i))}{', .slots = { ' + ''.join(f'v{j+1}, ' for j in range(i)) + '}' if i else '' } }}")
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_0(_struct_type, _typename, _name, _flags, _make_new) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_1(_struct_type, _typename, _name, _flags, _make_new, f1, v1) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slots = { v1, } }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_2(_struct_type, _typename, _name, _flags, _make_new, f1, v1, f2, v2) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slots = { v1, v2, } }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_3(_struct_type, _typename, _name, _flags, _make_new, f1, v1, f2, v2, f3, v3) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slots = { v1, v2, v3, } }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_4(_struct_type, _typename, _name, _flags, _make_new, f1, v1, f2, v2, f3, v3, f4, v4) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slots = { v1, v2, v3, v4, } }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_5(_struct_type, _typename, _name, _flags, _make_new, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slots = { v1, v2, v3, v4, v5, } }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_6(_struct_type, _typename, _name, _flags, _make_new, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slots = { v1, v2, v3, v4, v5, v6, } }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_7(_struct_type, _typename, _name, _flags, _make_new, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slots = { v1, v2, v3, v4, v5, v6, v7, } }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_8(_struct_type, _typename, _name, _flags, _make_new, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slot_index_##f8 = 8, .slots = { v1, v2, v3, v4, v5, v6, v7, v8, } }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_9(_struct_type, _typename, _name, _flags, _make_new, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8, f9, v9) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slot_index_##f8 = 8, .slot_index_##f9 = 9, .slots = { v1, v2, v3, v4, v5, v6, v7, v8, v9, } }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_10(_struct_type, _typename, _name, _flags, _make_new, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8, f9, v9, f10, v10) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slot_index_##f8 = 8, .slot_index_##f9 = 9, .slot_index_##f10 = 10, .slots = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, } }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_11(_struct_type, _typename, _name, _flags, _make_new, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8, f9, v9, f10, v10, f11, v11) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slot_index_##f8 = 8, .slot_index_##f9 = 9, .slot_index_##f10 = 10, .slot_index_##f11 = 11, .slots = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, } }
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_12(_struct_type, _typename, _name, _flags, _make_new, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8, f9, v9, f10, v10, f11, v11, f12, v12) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .make_new = _make_new, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slot_index_##f8 = 8, .slot_index_##f9 = 9, .slot_index_##f10 = 10, .slot_index_##f11 = 11, .slot_index_##f12 = 12, .slots = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, } }
+// print(f"#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_{i}(_struct_type, _typename, _name, _flags{''.join(f', f{j+1}, v{j+1}' for j in range(i))}) const _struct_type _typename = {{ .base = {{ &mp_type_type }}, .name = _name, .flags = _flags{''.join(f', .slot_index_##f{j+1} = {j+1}' for j in range(i))}{', .slots = { ' + ''.join(f'v{j+1}, ' for j in range(i)) + '}' if i else '' } }}")
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_0(_struct_type, _typename, _name, _flags) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_1(_struct_type, _typename, _name, _flags, f1, v1) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slots = { v1, } }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_2(_struct_type, _typename, _name, _flags, f1, v1, f2, v2) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slots = { v1, v2, } }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_3(_struct_type, _typename, _name, _flags, f1, v1, f2, v2, f3, v3) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slots = { v1, v2, v3, } }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_4(_struct_type, _typename, _name, _flags, f1, v1, f2, v2, f3, v3, f4, v4) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slots = { v1, v2, v3, v4, } }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_5(_struct_type, _typename, _name, _flags, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slots = { v1, v2, v3, v4, v5, } }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_6(_struct_type, _typename, _name, _flags, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slots = { v1, v2, v3, v4, v5, v6, } }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_7(_struct_type, _typename, _name, _flags, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slots = { v1, v2, v3, v4, v5, v6, v7, } }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_8(_struct_type, _typename, _name, _flags, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slot_index_##f8 = 8, .slots = { v1, v2, v3, v4, v5, v6, v7, v8, } }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_9(_struct_type, _typename, _name, _flags, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8, f9, v9) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slot_index_##f8 = 8, .slot_index_##f9 = 9, .slots = { v1, v2, v3, v4, v5, v6, v7, v8, v9, } }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_10(_struct_type, _typename, _name, _flags, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8, f9, v9, f10, v10) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slot_index_##f8 = 8, .slot_index_##f9 = 9, .slot_index_##f10 = 10, .slots = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, } }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_11(_struct_type, _typename, _name, _flags, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8, f9, v9, f10, v10, f11, v11) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slot_index_##f8 = 8, .slot_index_##f9 = 9, .slot_index_##f10 = 10, .slot_index_##f11 = 11, .slots = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, } }
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS_12(_struct_type, _typename, _name, _flags, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8, f9, v9, f10, v10, f11, v11, f12, v12) const _struct_type _typename = { .base = { &mp_type_type }, .name = _name, .flags = _flags, .slot_index_##f1 = 1, .slot_index_##f2 = 2, .slot_index_##f3 = 3, .slot_index_##f4 = 4, .slot_index_##f5 = 5, .slot_index_##f6 = 6, .slot_index_##f7 = 7, .slot_index_##f8 = 8, .slot_index_##f9 = 9, .slot_index_##f10 = 10, .slot_index_##f11 = 11, .slot_index_##f12 = 12, .slots = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, } }
#define MP_OBJ_TYPE_HAS_SLOT(t, f) ((t)->slot_index_##f)
#define MP_OBJ_TYPE_GET_SLOT(t, f) (_MP_OBJ_TYPE_SLOT_TYPE_##f(t)->slots[(t)->slot_index_##f - 1])
#define MP_OBJ_TYPE_GET_SLOT_OR_NULL(t, f) (_MP_OBJ_TYPE_SLOT_TYPE_##f(MP_OBJ_TYPE_HAS_SLOT(t, f) ? MP_OBJ_TYPE_GET_SLOT(t, f) : NULL))
#define MP_OBJ_TYPE_SET_SLOT(t, f, v, n) ((t)->slot_index_##f = (n) + 1, (t)->slots[(t)->slot_index_##f - 1] = (void *)v)
#define MP_OBJ_TYPE_OFFSETOF_SLOT(f) (offsetof(mp_obj_type_t, slot_index_##f))
-// For everything except make_new, the offset is to the uint8_t index. For make_new, we need to check the pointer.
-#define MP_OBJ_TYPE_HAS_SLOT_BY_OFFSET(t, offset) (*(uint8_t *)((char *)(t) + (offset)) != 0 || (offset == offsetof(mp_obj_type_t, make_new) && t->make_new))
+#define MP_OBJ_TYPE_HAS_SLOT_BY_OFFSET(t, offset) (*(uint8_t *)((char *)(t) + (offset)) != 0)
// Workaround for https://docs.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview?view=msvc-160#macro-arguments-are-unpacked
#define MP_DEFINE_CONST_OBJ_TYPE_EXPAND(x) x
// This macro evaluates to MP_DEFINE_CONST_OBJ_TYPE_NARGS_##N, where N is the value
-// of the 30th argument (30 is 13*2 + 4).
-#define MP_DEFINE_CONST_OBJ_TYPE_NARGS(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, N, ...) MP_DEFINE_CONST_OBJ_TYPE_NARGS_##N
+// of the 29th argument (29 is 13*2 + 3).
+#define MP_DEFINE_CONST_OBJ_TYPE_NARGS(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, N, ...) MP_DEFINE_CONST_OBJ_TYPE_NARGS_##N
// These macros are used to define a object type in ROM.
// Invoke as MP_DEFINE_CONST_OBJ_TYPE(_typename, _name, _flags, _make_new [, slot, func]*)
// They use the number of arguments to select which MP_DEFINE_CONST_OBJ_TYPE_*
// macro to use based on the number of arguments. It works by shifting the
// numeric values 12, 11, ... 0 by the number of arguments, such that the
-// 30th argument ends up being the number to use. The _INV values are
+// 29th argument ends up being the number to use. The _INV values are
// placeholders because the slot arguments come in pairs.
#define MP_DEFINE_CONST_OBJ_TYPE(...) MP_DEFINE_CONST_OBJ_TYPE_EXPAND(MP_DEFINE_CONST_OBJ_TYPE_NARGS(__VA_ARGS__, _INV, 12, _INV, 11, _INV, 10, _INV, 9, _INV, 8, _INV, 7, _INV, 6, _INV, 5, _INV, 4, _INV, 3, _INV, 2, _INV, 1, _INV, 0)(mp_obj_type_t, __VA_ARGS__))
#define MP_DEFINE_CONST_OBJ_FULL_TYPE(...) MP_DEFINE_CONST_OBJ_TYPE_EXPAND(MP_DEFINE_CONST_OBJ_TYPE_NARGS(__VA_ARGS__, _INV, 12, _INV, 11, _INV, 10, _INV, 9, _INV, 8, _INV, 7, _INV, 6, _INV, 5, _INV, 4, _INV, 3, _INV, 2, _INV, 1, _INV, 0)(mp_obj_full_type_t, __VA_ARGS__))
@@ -916,7 +914,7 @@ void *mp_obj_malloc_helper(size_t num_bytes, const mp_obj_type_t *type);
#define mp_obj_is_int(o) (mp_obj_is_small_int(o) || mp_obj_is_exact_type(o, &mp_type_int))
#define mp_obj_is_str(o) (mp_obj_is_qstr(o) || mp_obj_is_exact_type(o, &mp_type_str))
#define mp_obj_is_str_or_bytes(o) (mp_obj_is_qstr(o) || (mp_obj_is_obj(o) && MP_OBJ_TYPE_GET_SLOT_OR_NULL(((mp_obj_base_t *)MP_OBJ_TO_PTR(o))->type, binary_op) == mp_obj_str_binary_op))
-#define mp_obj_is_dict_or_ordereddict(o) (mp_obj_is_obj(o) && ((mp_obj_base_t *)MP_OBJ_TO_PTR(o))->type->make_new == mp_obj_dict_make_new)
+#define mp_obj_is_dict_or_ordereddict(o) (mp_obj_is_obj(o) && MP_OBJ_TYPE_GET_SLOT_OR_NULL(((mp_obj_base_t *)MP_OBJ_TO_PTR(o))->type, make_new) == mp_obj_dict_make_new)
#define mp_obj_is_fun(o) (mp_obj_is_obj(o) && (((mp_obj_base_t *)MP_OBJ_TO_PTR(o))->type->name == MP_QSTR_function))
mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict);
@@ -1032,7 +1030,7 @@ mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in);
mp_uint_t mp_obj_int_get_uint_checked(mp_const_obj_t self_in);
// exception
-#define mp_obj_is_native_exception_instance(o) (mp_obj_get_type(o)->make_new == mp_obj_exception_make_new)
+#define mp_obj_is_native_exception_instance(o) (MP_OBJ_TYPE_GET_SLOT_OR_NULL(mp_obj_get_type(o), make_new) == mp_obj_exception_make_new)
bool mp_obj_is_exception_type(mp_obj_t self_in);
bool mp_obj_is_exception_instance(mp_obj_t self_in);
bool mp_obj_exception_match(mp_obj_t exc, mp_const_obj_t exc_type);
@@ -1044,7 +1042,7 @@ mp_obj_t mp_obj_exception_make_new(const mp_obj_type_t *type_in, size_t n_args,
mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in);
void mp_init_emergency_exception_buf(void);
static inline mp_obj_t mp_obj_new_exception_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg) {
- assert(exc_type->make_new == mp_obj_exception_make_new);
+ assert(MP_OBJ_TYPE_GET_SLOT_OR_NULL(exc_type, make_new) == mp_obj_exception_make_new);
return mp_obj_exception_make_new(exc_type, 1, 0, &arg);
}
diff --git a/py/objarray.c b/py/objarray.c
index 0d1032929f..42fc0749d2 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -575,7 +575,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_array,
MP_QSTR_array,
MP_TYPE_FLAG_ITER_IS_GETITER,
- array_make_new,
+ make_new, array_make_new,
print, array_print,
iter, array_iterator_new,
unary_op, array_unary_op,
@@ -591,7 +591,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_bytearray,
MP_QSTR_bytearray,
MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE | MP_TYPE_FLAG_ITER_IS_GETITER,
- bytearray_make_new,
+ make_new, bytearray_make_new,
print, array_print,
iter, array_iterator_new,
unary_op, array_unary_op,
@@ -619,7 +619,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_memoryview,
MP_QSTR_memoryview,
MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE | MP_TYPE_FLAG_ITER_IS_GETITER,
- memoryview_make_new,
+ make_new, memoryview_make_new,
iter, array_iterator_new,
unary_op, array_unary_op,
binary_op, array_binary_op,
@@ -677,7 +677,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_array_it,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
iter, array_it_iternext
);
diff --git a/py/objattrtuple.c b/py/objattrtuple.c
index 2e207f4cf0..fbe04bedb8 100644
--- a/py/objattrtuple.c
+++ b/py/objattrtuple.c
@@ -84,7 +84,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_attrtuple,
MP_QSTR_tuple,
MP_TYPE_FLAG_ITER_IS_GETITER,
- MP_TYPE_NULL_MAKE_NEW,
// reuse tuple to save on a qstr
print, mp_obj_attrtuple_print,
unary_op, mp_obj_tuple_unary_op,
diff --git a/py/objbool.c b/py/objbool.c
index 5d014bbb8e..3267ff98bb 100644
--- a/py/objbool.c
+++ b/py/objbool.c
@@ -89,7 +89,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_bool,
MP_QSTR_bool,
MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE,
- bool_make_new,
+ make_new, bool_make_new,
print, bool_print,
unary_op, bool_unary_op,
binary_op, bool_binary_op
diff --git a/py/objboundmeth.c b/py/objboundmeth.c
index f4b3b9b7df..8486f876f9 100644
--- a/py/objboundmeth.c
+++ b/py/objboundmeth.c
@@ -111,7 +111,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_bound_meth,
MP_QSTR_bound_method,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
BOUND_METH_TYPE_PRINT
BOUND_METH_TYPE_ATTR
call, bound_meth_call
diff --git a/py/objcell.c b/py/objcell.c
index b100fae4fe..0a74e29d20 100644
--- a/py/objcell.c
+++ b/py/objcell.c
@@ -48,7 +48,7 @@ STATIC void cell_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t k
STATIC MP_DEFINE_CONST_OBJ_TYPE(
// cell representation is just value in < >
- mp_type_cell, MP_QSTR_, MP_TYPE_FLAG_NONE, MP_TYPE_NULL_MAKE_NEW
+ mp_type_cell, MP_QSTR_, MP_TYPE_FLAG_NONE
CELL_TYPE_PRINT
);
diff --git a/py/objclosure.c b/py/objclosure.c
index 45a3e83c46..6059d18100 100644
--- a/py/objclosure.c
+++ b/py/objclosure.c
@@ -99,7 +99,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_closure,
MP_QSTR_closure,
MP_TYPE_FLAG_BINDS_SELF,
- MP_TYPE_NULL_MAKE_NEW,
CLOSURE_TYPE_ATTR
CLOSURE_TYPE_PRINT
call, closure_call
diff --git a/py/objcomplex.c b/py/objcomplex.c
index cf213d718a..ddd103eeb4 100644
--- a/py/objcomplex.c
+++ b/py/objcomplex.c
@@ -152,7 +152,8 @@ STATIC void complex_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
}
MP_DEFINE_CONST_OBJ_TYPE(
- mp_type_complex, MP_QSTR_complex, MP_TYPE_FLAG_EQ_NOT_REFLEXIVE | MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE, complex_make_new,
+ mp_type_complex, MP_QSTR_complex, MP_TYPE_FLAG_EQ_NOT_REFLEXIVE | MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE,
+ make_new, complex_make_new,
print, complex_print,
unary_op, complex_unary_op,
binary_op, complex_binary_op,
diff --git a/py/objdeque.c b/py/objdeque.c
index 1a8f76ca11..8b52b8d387 100644
--- a/py/objdeque.c
+++ b/py/objdeque.c
@@ -159,7 +159,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_deque,
MP_QSTR_deque,
MP_TYPE_FLAG_NONE,
- deque_make_new,
+ make_new, deque_make_new,
unary_op, deque_unary_op,
locals_dict, &deque_locals_dict
);
diff --git a/py/objdict.c b/py/objdict.c
index 7755d7b786..68c33961c7 100644
--- a/py/objdict.c
+++ b/py/objdict.c
@@ -465,7 +465,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_dict_view_it,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
iter, dict_view_it_iternext
);
@@ -517,7 +516,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_dict_view,
MP_QSTR_dict_view,
MP_TYPE_FLAG_ITER_IS_GETITER,
- MP_TYPE_NULL_MAKE_NEW,
print, dict_view_print,
binary_op, dict_view_binary_op,
iter, dict_view_getiter
@@ -592,7 +590,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_dict,
MP_QSTR_dict,
MP_TYPE_FLAG_ITER_IS_GETITER,
- mp_obj_dict_make_new,
+ make_new, mp_obj_dict_make_new,
print, dict_print,
unary_op, dict_unary_op,
binary_op, dict_binary_op,
@@ -606,7 +604,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_ordereddict,
MP_QSTR_OrderedDict,
MP_TYPE_FLAG_ITER_IS_GETITER,
- mp_obj_dict_make_new,
+ make_new, mp_obj_dict_make_new,
print, dict_print,
unary_op, dict_unary_op,
binary_op, dict_binary_op,
diff --git a/py/objenumerate.c b/py/objenumerate.c
index eea9e3e381..40bed919ed 100644
--- a/py/objenumerate.c
+++ b/py/objenumerate.c
@@ -71,7 +71,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_enumerate,
MP_QSTR_enumerate,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- enumerate_make_new,
+ make_new, enumerate_make_new,
iter, enumerate_iternext
);
diff --git a/py/objexcept.c b/py/objexcept.c
index 190213e12f..3b76ae62cc 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -288,7 +288,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_BaseException,
MP_QSTR_BaseException,
MP_TYPE_FLAG_NONE,
- mp_obj_exception_make_new,
+ make_new, mp_obj_exception_make_new,
print, mp_obj_exception_print,
attr, mp_obj_exception_attr
);
@@ -375,12 +375,12 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
// *FORMAT-ON*
mp_obj_t mp_obj_new_exception(const mp_obj_type_t *exc_type) {
- assert(exc_type->make_new == mp_obj_exception_make_new);
+ assert(MP_OBJ_TYPE_GET_SLOT_OR_NULL(exc_type, make_new) == mp_obj_exception_make_new);
return mp_obj_exception_make_new(exc_type, 0, 0, NULL);
}
mp_obj_t mp_obj_new_exception_args(const mp_obj_type_t *exc_type, size_t n_args, const mp_obj_t *args) {
- assert(exc_type->make_new == mp_obj_exception_make_new);
+ assert(MP_OBJ_TYPE_GET_SLOT_OR_NULL(exc_type, make_new) == mp_obj_exception_make_new);
return mp_obj_exception_make_new(exc_type, n_args, 0, args);
}
@@ -388,7 +388,7 @@ mp_obj_t mp_obj_new_exception_args(const mp_obj_type_t *exc_type, size_t n_args,
mp_obj_t mp_obj_new_exception_msg(const mp_obj_type_t *exc_type, mp_rom_error_text_t msg) {
// Check that the given type is an exception type
- assert(exc_type->make_new == mp_obj_exception_make_new);
+ assert(MP_OBJ_TYPE_GET_SLOT_OR_NULL(exc_type, make_new) == mp_obj_exception_make_new);
// Try to allocate memory for the message
mp_obj_str_t *o_str = m_new_obj_maybe(mp_obj_str_t);
@@ -467,7 +467,7 @@ mp_obj_t mp_obj_new_exception_msg_vlist(const mp_obj_type_t *exc_type, mp_rom_er
assert(fmt != NULL);
// Check that the given type is an exception type
- assert(exc_type->make_new == mp_obj_exception_make_new);
+ assert(MP_OBJ_TYPE_GET_SLOT_OR_NULL(exc_type, make_new) == mp_obj_exception_make_new);
// Try to allocate memory for the message
mp_obj_str_t *o_str = m_new_obj_maybe(mp_obj_str_t);
@@ -538,7 +538,7 @@ bool mp_obj_is_exception_type(mp_obj_t self_in) {
if (mp_obj_is_type(self_in, &mp_type_type)) {
// optimisation when self_in is a builtin exception
mp_obj_type_t *self = MP_OBJ_TO_PTR(self_in);
- if (self->make_new == mp_obj_exception_make_new) {
+ if (MP_OBJ_TYPE_GET_SLOT_OR_NULL(self, make_new) == mp_obj_exception_make_new) {
return true;
}
}
diff --git a/py/objexcept.h b/py/objexcept.h
index 5d56d67d73..d532f66609 100644
--- a/py/objexcept.h
+++ b/py/objexcept.h
@@ -41,7 +41,8 @@ void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kin
void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
#define MP_DEFINE_EXCEPTION(exc_name, base_name) \
- MP_DEFINE_CONST_OBJ_TYPE(mp_type_##exc_name, MP_QSTR_##exc_name, MP_TYPE_FLAG_NONE, mp_obj_exception_make_new, \
+ MP_DEFINE_CONST_OBJ_TYPE(mp_type_##exc_name, MP_QSTR_##exc_name, MP_TYPE_FLAG_NONE, \
+ make_new, mp_obj_exception_make_new, \
print, mp_obj_exception_print, \
attr, mp_obj_exception_attr, \
parent, &mp_type_##base_name \
diff --git a/py/objfilter.c b/py/objfilter.c
index bfe651f40d..2a657fde4b 100644
--- a/py/objfilter.c
+++ b/py/objfilter.c
@@ -64,7 +64,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_filter,
MP_QSTR_filter,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- filter_make_new,
+ make_new, filter_make_new,
iter, filter_iternext
);
diff --git a/py/objfloat.c b/py/objfloat.c
index 9ecbab7a4d..c862b4843b 100644
--- a/py/objfloat.c
+++ b/py/objfloat.c
@@ -183,7 +183,8 @@ STATIC mp_obj_t float_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs
}
MP_DEFINE_CONST_OBJ_TYPE(
- mp_type_float, MP_QSTR_float, MP_TYPE_FLAG_EQ_NOT_REFLEXIVE | MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE, float_make_new,
+ mp_type_float, MP_QSTR_float, MP_TYPE_FLAG_EQ_NOT_REFLEXIVE | MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE,
+ make_new, float_make_new,
print, float_print,
unary_op, float_unary_op,
binary_op, float_binary_op
diff --git a/py/objfun.c b/py/objfun.c
index d6ff354575..390ddaa2d2 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -57,7 +57,7 @@ STATIC mp_obj_t fun_builtin_0_call(mp_obj_t self_in, size_t n_args, size_t n_kw,
}
MP_DEFINE_CONST_OBJ_TYPE(
- mp_type_fun_builtin_0, MP_QSTR_function, MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_BUILTIN_FUN, MP_TYPE_NULL_MAKE_NEW,
+ mp_type_fun_builtin_0, MP_QSTR_function, MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_BUILTIN_FUN,
call, fun_builtin_0_call,
unary_op, mp_generic_unary_op
);
@@ -70,7 +70,7 @@ STATIC mp_obj_t fun_builtin_1_call(mp_obj_t self_in, size_t n_args, size_t n_kw,
}
MP_DEFINE_CONST_OBJ_TYPE(
- mp_type_fun_builtin_1, MP_QSTR_function, MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_BUILTIN_FUN, MP_TYPE_NULL_MAKE_NEW,
+ mp_type_fun_builtin_1, MP_QSTR_function, MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_BUILTIN_FUN,
call, fun_builtin_1_call,
unary_op, mp_generic_unary_op
);
@@ -83,7 +83,7 @@ STATIC mp_obj_t fun_builtin_2_call(mp_obj_t self_in, size_t n_args, size_t n_kw,
}
MP_DEFINE_CONST_OBJ_TYPE(
- mp_type_fun_builtin_2, MP_QSTR_function, MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_BUILTIN_FUN, MP_TYPE_NULL_MAKE_NEW,
+ mp_type_fun_builtin_2, MP_QSTR_function, MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_BUILTIN_FUN,
call, fun_builtin_2_call,
unary_op, mp_generic_unary_op
);
@@ -96,7 +96,7 @@ STATIC mp_obj_t fun_builtin_3_call(mp_obj_t self_in, size_t n_args, size_t n_kw,
}
MP_DEFINE_CONST_OBJ_TYPE(
- mp_type_fun_builtin_3, MP_QSTR_function, MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_BUILTIN_FUN, MP_TYPE_NULL_MAKE_NEW,
+ mp_type_fun_builtin_3, MP_QSTR_function, MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_BUILTIN_FUN,
call, fun_builtin_3_call,
unary_op, mp_generic_unary_op
);
@@ -125,7 +125,7 @@ STATIC mp_obj_t fun_builtin_var_call(mp_obj_t self_in, size_t n_args, size_t n_k
}
MP_DEFINE_CONST_OBJ_TYPE(
- mp_type_fun_builtin_var, MP_QSTR_function, MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_BUILTIN_FUN, MP_TYPE_NULL_MAKE_NEW,
+ mp_type_fun_builtin_var, MP_QSTR_function, MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_BUILTIN_FUN,
call, fun_builtin_var_call,
unary_op, mp_generic_unary_op
);
@@ -368,7 +368,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_fun_bc,
MP_QSTR_function,
MP_TYPE_FLAG_BINDS_SELF,
- MP_TYPE_NULL_MAKE_NEW,
FUN_BC_TYPE_PRINT
FUN_BC_TYPE_ATTR
call, fun_bc_call,
@@ -431,7 +430,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_fun_native,
MP_QSTR_function,
MP_TYPE_FLAG_BINDS_SELF,
- MP_TYPE_NULL_MAKE_NEW,
FUN_BC_TYPE_PRINT
FUN_BC_TYPE_ATTR
call, fun_native_call,
@@ -542,7 +540,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_fun_asm,
MP_QSTR_function,
MP_TYPE_FLAG_BINDS_SELF,
- MP_TYPE_NULL_MAKE_NEW,
call, fun_asm_call,
unary_op, mp_generic_unary_op
);
diff --git a/py/objgenerator.c b/py/objgenerator.c
index d8515c13ce..8175dbd683 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -80,7 +80,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_gen_wrap,
MP_QSTR_generator,
MP_TYPE_FLAG_BINDS_SELF,
- MP_TYPE_NULL_MAKE_NEW,
GEN_WRAP_TYPE_ATTR
call, gen_wrap_call,
unary_op, mp_generic_unary_op
@@ -146,7 +145,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_native_gen_wrap,
MP_QSTR_generator,
MP_TYPE_FLAG_BINDS_SELF,
- MP_TYPE_NULL_MAKE_NEW,
call, native_gen_wrap_call,
NATIVE_GEN_WRAP_TYPE_ATTR
unary_op, mp_generic_unary_op
@@ -371,7 +369,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_gen_instance,
MP_QSTR_generator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
print, gen_instance_print,
unary_op, mp_generic_unary_op,
iter, gen_instance_iternext,
diff --git a/py/objgetitemiter.c b/py/objgetitemiter.c
index 134cbcd629..c598d1daac 100644
--- a/py/objgetitemiter.c
+++ b/py/objgetitemiter.c
@@ -60,7 +60,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_it,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
iter, it_iternext
);
diff --git a/py/objint.c b/py/objint.c
index f06bc441f1..1a3ad86947 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -461,7 +461,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_int,
MP_QSTR_int,
MP_TYPE_FLAG_NONE,
- mp_obj_int_make_new,
+ make_new, mp_obj_int_make_new,
print, mp_obj_int_print,
unary_op, mp_obj_int_unary_op,
binary_op, mp_obj_int_binary_op,
diff --git a/py/objlist.c b/py/objlist.c
index 8d18344ea8..18da91ba3a 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -71,7 +71,7 @@ STATIC mp_obj_t list_extend_from_iter(mp_obj_t list, mp_obj_t iterable) {
return list;
}
-STATIC mp_obj_t list_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+mp_obj_t mp_obj_list_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 1, false);
@@ -456,7 +456,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_list,
MP_QSTR_list,
MP_TYPE_FLAG_ITER_IS_GETITER,
- list_make_new,
+ make_new, mp_obj_list_make_new,
print, list_print,
unary_op, list_unary_op,
binary_op, list_binary_op,
diff --git a/py/objlist.h b/py/objlist.h
index a43663db76..a3bba68028 100644
--- a/py/objlist.h
+++ b/py/objlist.h
@@ -36,5 +36,6 @@ typedef struct _mp_obj_list_t {
} mp_obj_list_t;
void mp_obj_list_init(mp_obj_list_t *o, size_t n);
+mp_obj_t mp_obj_list_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
#endif // MICROPY_INCLUDED_PY_OBJLIST_H
diff --git a/py/objmap.c b/py/objmap.c
index 115832e387..e7e594cd2c 100644
--- a/py/objmap.c
+++ b/py/objmap.c
@@ -67,6 +67,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_map,
MP_QSTR_map,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- map_make_new,
+ make_new, map_make_new,
iter, map_iternext
);
diff --git a/py/objmodule.c b/py/objmodule.c
index 6fc3653e6a..d14a59b863 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -134,7 +134,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_module,
MP_QSTR_module,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, module_print,
attr, module_attr
);
diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c
index 3b45d8f76f..75e21494b4 100644
--- a/py/objnamedtuple.c
+++ b/py/objnamedtuple.c
@@ -157,14 +157,14 @@ STATIC mp_obj_t mp_obj_new_namedtuple_type(qstr name, size_t n_fields, mp_obj_t
type->base.type = &mp_type_type;
type->flags = MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE; // can match tuple
type->name = name;
- type->make_new = namedtuple_make_new;
- MP_OBJ_TYPE_SET_SLOT(type, print, namedtuple_print, 0);
- MP_OBJ_TYPE_SET_SLOT(type, unary_op, mp_obj_tuple_unary_op, 1);
- MP_OBJ_TYPE_SET_SLOT(type, binary_op, mp_obj_tuple_binary_op, 2);
- MP_OBJ_TYPE_SET_SLOT(type, attr, namedtuple_attr, 3);
- MP_OBJ_TYPE_SET_SLOT(type, subscr, mp_obj_tuple_subscr, 4);
- MP_OBJ_TYPE_SET_SLOT(type, iter, mp_obj_tuple_getiter, 5);
- MP_OBJ_TYPE_SET_SLOT(type, parent, &mp_type_tuple, 6);
+ MP_OBJ_TYPE_SET_SLOT(type, make_new, namedtuple_make_new, 0);
+ MP_OBJ_TYPE_SET_SLOT(type, print, namedtuple_print, 1);
+ MP_OBJ_TYPE_SET_SLOT(type, unary_op, mp_obj_tuple_unary_op, 2);
+ MP_OBJ_TYPE_SET_SLOT(type, binary_op, mp_obj_tuple_binary_op, 3);
+ MP_OBJ_TYPE_SET_SLOT(type, attr, namedtuple_attr, 4);
+ MP_OBJ_TYPE_SET_SLOT(type, subscr, mp_obj_tuple_subscr, 5);
+ MP_OBJ_TYPE_SET_SLOT(type, iter, mp_obj_tuple_getiter, 6);
+ MP_OBJ_TYPE_SET_SLOT(type, parent, &mp_type_tuple, 7);
return MP_OBJ_FROM_PTR(o);
}
diff --git a/py/objnamedtuple.h b/py/objnamedtuple.h
index db4a3d87d8..c4f4149fd6 100644
--- a/py/objnamedtuple.h
+++ b/py/objnamedtuple.h
@@ -29,9 +29,9 @@
#include "py/objtuple.h"
typedef struct _mp_obj_namedtuple_type_t {
- // This is a mp_obj_type_t with seven slots.
+ // This is a mp_obj_type_t with eight slots.
mp_obj_empty_type_t base;
- void *slots[7];
+ void *slots[8];
size_t n_fields;
qstr fields[];
} mp_obj_namedtuple_type_t;
diff --git a/py/objnone.c b/py/objnone.c
index 4fffbc997e..4f8996e897 100644
--- a/py/objnone.c
+++ b/py/objnone.c
@@ -47,7 +47,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_NoneType,
MP_QSTR_NoneType,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, none_print,
unary_op, mp_generic_unary_op
);
diff --git a/py/objobject.c b/py/objobject.c
index ffad610707..1acae6d00b 100644
--- a/py/objobject.c
+++ b/py/objobject.c
@@ -121,6 +121,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_object,
MP_QSTR_object,
MP_TYPE_FLAG_NONE,
- object_make_new
+ make_new, object_make_new
OBJECT_TYPE_LOCALS_DICT
);
diff --git a/py/objpolyiter.c b/py/objpolyiter.c
index 7a45b6b73f..78b600abac 100644
--- a/py/objpolyiter.c
+++ b/py/objpolyiter.c
@@ -49,7 +49,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_polymorph_iter,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
iter, polymorph_it_iternext
);
@@ -81,7 +80,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_polymorph_iter_with_finaliser,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
iter, polymorph_it_iternext,
locals_dict, &mp_obj_polymorph_iter_locals_dict
);
diff --git a/py/objproperty.c b/py/objproperty.c
index ce3b572591..2d3af10e8c 100644
--- a/py/objproperty.c
+++ b/py/objproperty.c
@@ -94,7 +94,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_property,
MP_QSTR_property,
MP_TYPE_FLAG_NONE,
- property_make_new,
+ make_new, property_make_new,
locals_dict, &property_locals_dict
);
diff --git a/py/objrange.c b/py/objrange.c
index 1ad8f6031f..f0fe56d9db 100644
--- a/py/objrange.c
+++ b/py/objrange.c
@@ -54,7 +54,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_range_it,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- MP_TYPE_NULL_MAKE_NEW,
iter, range_it_iternext
);
@@ -225,7 +224,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_range,
MP_QSTR_range,
MP_TYPE_FLAG_NONE,
- range_make_new,
+ make_new, range_make_new,
RANGE_TYPE_BINOP
RANGE_TYPE_ATTR
print, range_print,
diff --git a/py/objreversed.c b/py/objreversed.c
index e265266d3f..c66698f028 100644
--- a/py/objreversed.c
+++ b/py/objreversed.c
@@ -72,7 +72,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_reversed,
MP_QSTR_reversed,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- reversed_make_new,
+ make_new, reversed_make_new,
iter, reversed_iternext
);
diff --git a/py/objset.c b/py/objset.c
index b827f49f40..906807889a 100644
--- a/py/objset.c
+++ b/py/objset.c
@@ -543,7 +543,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_set,
MP_QSTR_set,
MP_TYPE_FLAG_ITER_IS_GETITER,
- set_make_new,
+ make_new, set_make_new,
print, set_print,
unary_op, set_unary_op,
binary_op, set_binary_op,
@@ -569,7 +569,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_frozenset,
MP_QSTR_frozenset,
MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE | MP_TYPE_FLAG_ITER_IS_GETITER,
- set_make_new,
+ make_new, set_make_new,
print, set_print,
unary_op, set_unary_op,
binary_op, set_binary_op,
diff --git a/py/objsingleton.c b/py/objsingleton.c
index 4a099657d4..dc73d28c27 100644
--- a/py/objsingleton.c
+++ b/py/objsingleton.c
@@ -44,7 +44,7 @@ STATIC void singleton_print(const mp_print_t *print, mp_obj_t self_in, mp_print_
}
MP_DEFINE_CONST_OBJ_TYPE(
- mp_type_singleton, MP_QSTR_, MP_TYPE_FLAG_NONE, MP_TYPE_NULL_MAKE_NEW,
+ mp_type_singleton, MP_QSTR_, MP_TYPE_FLAG_NONE,
print, singleton_print,
unary_op, mp_generic_unary_op
);
diff --git a/py/objslice.c b/py/objslice.c
index d1dbb24586..01d4da0dbd 100644
--- a/py/objslice.c
+++ b/py/objslice.c
@@ -104,7 +104,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_slice,
MP_QSTR_slice,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
SLICE_TYPE_ATTR_OR_LOCALS_DICT
print, slice_print
);
diff --git a/py/objstr.c b/py/objstr.c
index 12f6e15d04..50ab0018ed 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -482,7 +482,7 @@ STATIC mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) {
if (!mp_obj_is_type(arg, &mp_type_list) && !mp_obj_is_type(arg, &mp_type_tuple)) {
// arg is not a list nor a tuple, try to convert it to a list
// TODO: Try to optimize?
- arg = mp_type_list.make_new(&mp_type_list, 1, 0, &arg);
+ arg = mp_obj_list_make_new(&mp_type_list, 1, 0, &arg);
}
mp_obj_get_array(arg, &seq_len, &seq_items);
@@ -2147,7 +2147,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_str,
MP_QSTR_str,
MP_TYPE_FLAG_NONE,
- mp_obj_str_make_new,
+ make_new, mp_obj_str_make_new,
print, str_print,
binary_op, mp_obj_str_binary_op,
subscr, bytes_subscr,
@@ -2162,7 +2162,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_bytes,
MP_QSTR_bytes,
MP_TYPE_FLAG_NONE,
- bytes_make_new,
+ make_new, bytes_make_new,
print, str_print,
binary_op, mp_obj_str_binary_op,
subscr, bytes_subscr,
diff --git a/py/objstringio.c b/py/objstringio.c
index 4e19b83999..1a083449ba 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -248,7 +248,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_stringio,
MP_QSTR_StringIO,
MP_TYPE_FLAG_ITER_IS_STREAM,
- stringio_make_new,
+ make_new, stringio_make_new,
print, stringio_print,
protocol, &stringio_stream_p,
locals_dict, &stringio_locals_dict
@@ -265,7 +265,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_bytesio,
MP_QSTR_BytesIO,
MP_TYPE_FLAG_ITER_IS_STREAM,
- stringio_make_new,
+ make_new, stringio_make_new,
print, stringio_print,
protocol, &bytesio_stream_p,
locals_dict, &stringio_locals_dict
diff --git a/py/objstrunicode.c b/py/objstrunicode.c
index 9b28841ecd..93383b3c19 100644
--- a/py/objstrunicode.c
+++ b/py/objstrunicode.c
@@ -233,7 +233,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_str,
MP_QSTR_str,
MP_TYPE_FLAG_ITER_IS_GETITER,
- mp_obj_str_make_new,
+ make_new, mp_obj_str_make_new,
print, uni_print,
unary_op, uni_unary_op,
binary_op, mp_obj_str_binary_op,
diff --git a/py/objtuple.c b/py/objtuple.c
index 485d44c52a..9d6797b4ff 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -228,7 +228,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_tuple,
MP_QSTR_tuple,
MP_TYPE_FLAG_ITER_IS_GETITER,
- mp_obj_tuple_make_new,
+ make_new, mp_obj_tuple_make_new,
print, mp_obj_tuple_print,
unary_op, mp_obj_tuple_unary_op,
binary_op, mp_obj_tuple_binary_op,
diff --git a/py/objtype.c b/py/objtype.c
index 183dce071e..db364e0e5a 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -88,7 +88,7 @@ STATIC mp_obj_t native_base_init_wrapper(size_t n_args, const mp_obj_t *args) {
mp_obj_instance_t *self = MP_OBJ_TO_PTR(args[0]);
const mp_obj_type_t *native_base = NULL;
instance_count_native_bases(self->base.type, &native_base);
- self->subobj[0] = native_base->make_new(native_base, n_args - 1, 0, args + 1);
+ self->subobj[0] = MP_OBJ_TYPE_GET_SLOT(native_base, make_new)(native_base, n_args - 1, 0, args + 1);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(native_base_init_wrapper_obj, 1, MP_OBJ_FUN_ARGS_MAX, native_base_init_wrapper);
@@ -285,7 +285,7 @@ mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self, size_t n_args, size
struct class_lookup_data lookup = {
.obj = NULL,
.attr = MP_QSTR___new__,
- .slot_offset = offsetof(mp_obj_type_t, make_new),
+ .slot_offset = MP_OBJ_TYPE_OFFSETOF_SLOT(make_new),
.dest = init_fn,
.is_type = false,
};
@@ -362,7 +362,7 @@ mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self, size_t n_args, size
// If the type had a native base that was not explicitly initialised
// (constructed) by the Python __init__() method then construct it now.
if (native_base != NULL && o->subobj[0] == MP_OBJ_FROM_PTR(&native_base_init_wrapper_obj)) {
- o->subobj[0] = native_base->make_new(native_base, n_args, n_kw, args);
+ o->subobj[0] = MP_OBJ_TYPE_GET_SLOT(native_base, make_new)(native_base, n_args, n_kw, args);
}
return MP_OBJ_FROM_PTR(o);
@@ -998,7 +998,7 @@ STATIC mp_obj_t type_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp
mp_obj_type_t *self = MP_OBJ_TO_PTR(self_in);
- if (self->make_new == NULL) {
+ if (!MP_OBJ_TYPE_HAS_SLOT(self, make_new)) {
#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE
mp_raise_TypeError(MP_ERROR_TEXT("can't create instance"));
#else
@@ -1007,7 +1007,7 @@ STATIC mp_obj_t type_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp
}
// make new instance
- mp_obj_t o = self->make_new(self, n_args, n_kw, args);
+ mp_obj_t o = MP_OBJ_TYPE_GET_SLOT(self, make_new)(self, n_args, n_kw, args);
// return new instance
return o;
@@ -1109,7 +1109,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_type,
MP_QSTR_type,
MP_TYPE_FLAG_NONE,
- type_make_new,
+ make_new, type_make_new,
print, type_print,
call, type_call,
unary_op, mp_generic_unary_op,
@@ -1141,7 +1141,7 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict)
}
mp_obj_type_t *t = MP_OBJ_TO_PTR(bases_items[i]);
// TODO: Verify with CPy, tested on function type
- if (t->make_new == NULL) {
+ if (!MP_OBJ_TYPE_HAS_SLOT(t, make_new)) {
#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE
mp_raise_TypeError(MP_ERROR_TEXT("type isn't an acceptable base type"));
#else
@@ -1163,35 +1163,35 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict)
}
// Allocate a variable-sized mp_obj_type_t with as many slots as we need
- // (currently 9, plus 1 for base, plus 1 for base-protocol).
- // Note: 11 slots pushes it from 4 to 5 GC blocks.
- mp_obj_type_t *o = m_new_obj_var0(mp_obj_type_t, void *, 9 + (bases_len ? 1 : 0) + (base_protocol ? 1 : 0));
+ // (currently 10, plus 1 for base, plus 1 for base-protocol).
+ // Note: mp_obj_type_t is (2 + 3 + #slots) words, so going from 11 to 12 slots
+ // moves from 4 to 5 gc blocks.
+ mp_obj_type_t *o = m_new_obj_var0(mp_obj_type_t, void *, 10 + (bases_len ? 1 : 0) + (base_protocol ? 1 : 0));
o->base.type = &mp_type_type;
o->flags = base_flags;
o->name = name;
- o->make_new = mp_obj_instance_make_new;
- MP_OBJ_TYPE_SET_SLOT(o, print, instance_print, 0);
- MP_OBJ_TYPE_SET_SLOT(o, call, mp_obj_instance_call, 1);
- MP_OBJ_TYPE_SET_SLOT(o, unary_op, instance_unary_op, 2);
- MP_OBJ_TYPE_SET_SLOT(o, binary_op, instance_binary_op, 3);
- MP_OBJ_TYPE_SET_SLOT(o, attr, mp_obj_instance_attr, 4);
- MP_OBJ_TYPE_SET_SLOT(o, subscr, instance_subscr, 5);
- MP_OBJ_TYPE_SET_SLOT(o, iter, mp_obj_instance_getiter, 6);
- // MP_OBJ_TYPE_SET_SLOT(o, iternext, not implemented)
- MP_OBJ_TYPE_SET_SLOT(o, buffer, instance_get_buffer, 7);
+ MP_OBJ_TYPE_SET_SLOT(o, make_new, mp_obj_instance_make_new, 0);
+ MP_OBJ_TYPE_SET_SLOT(o, print, instance_print, 1);
+ MP_OBJ_TYPE_SET_SLOT(o, call, mp_obj_instance_call, 2);
+ MP_OBJ_TYPE_SET_SLOT(o, unary_op, instance_unary_op, 3);
+ MP_OBJ_TYPE_SET_SLOT(o, binary_op, instance_binary_op, 4);
+ MP_OBJ_TYPE_SET_SLOT(o, attr, mp_obj_instance_attr, 5);
+ MP_OBJ_TYPE_SET_SLOT(o, subscr, instance_subscr, 6);
+ MP_OBJ_TYPE_SET_SLOT(o, iter, mp_obj_instance_getiter, 7);
+ MP_OBJ_TYPE_SET_SLOT(o, buffer, instance_get_buffer, 8);
mp_obj_dict_t *locals_ptr = MP_OBJ_TO_PTR(locals_dict);
- MP_OBJ_TYPE_SET_SLOT(o, locals_dict, locals_ptr, 8);
+ MP_OBJ_TYPE_SET_SLOT(o, locals_dict, locals_ptr, 9);
if (bases_len > 0) {
if (bases_len >= 2) {
#if MICROPY_MULTIPLE_INHERITANCE
- MP_OBJ_TYPE_SET_SLOT(o, parent, MP_OBJ_TO_PTR(bases_tuple), 9);
+ MP_OBJ_TYPE_SET_SLOT(o, parent, MP_OBJ_TO_PTR(bases_tuple), 10);
#else
mp_raise_NotImplementedError(MP_ERROR_TEXT("multiple inheritance not supported"));
#endif
} else {
- MP_OBJ_TYPE_SET_SLOT(o, parent, MP_OBJ_TO_PTR(bases_items[0]), 9);
+ MP_OBJ_TYPE_SET_SLOT(o, parent, MP_OBJ_TO_PTR(bases_items[0]), 10);
}
// Inherit protocol from a base class. This allows to define an
@@ -1199,7 +1199,7 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict)
// Python method calls, and any subclass inheriting from it will
// support this feature.
if (base_protocol) {
- MP_OBJ_TYPE_SET_SLOT(o, protocol, base_protocol, 10);
+ MP_OBJ_TYPE_SET_SLOT(o, protocol, base_protocol, 11);
}
}
@@ -1292,7 +1292,7 @@ STATIC void super_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
// Allow a call super().__init__() to reach any native base classes.
if (attr == MP_QSTR___init__) {
- lookup.slot_offset = offsetof(mp_obj_type_t, make_new);
+ lookup.slot_offset = MP_OBJ_TYPE_OFFSETOF_SLOT(make_new);
}
if (!MP_OBJ_TYPE_HAS_SLOT(type, parent)) {
@@ -1340,7 +1340,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_super,
MP_QSTR_super,
MP_TYPE_FLAG_NONE,
- super_make_new,
+ make_new, super_make_new,
print, super_print,
attr, super_attr
);
@@ -1463,12 +1463,12 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_staticmethod,
MP_QSTR_staticmethod,
MP_TYPE_FLAG_NONE,
- static_class_method_make_new
+ make_new, static_class_method_make_new
);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_classmethod,
MP_QSTR_classmethod,
MP_TYPE_FLAG_NONE,
- static_class_method_make_new
+ make_new, static_class_method_make_new
);
diff --git a/py/objtype.h b/py/objtype.h
index 2c613b9045..76a290760c 100644
--- a/py/objtype.h
+++ b/py/objtype.h
@@ -46,8 +46,8 @@ mp_obj_instance_t *mp_obj_new_instance(const mp_obj_type_t *cls, const mp_obj_ty
bool mp_obj_instance_is_callable(mp_obj_t self_in);
mp_obj_t mp_obj_instance_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
-#define mp_obj_is_instance_type(type) ((type)->make_new == mp_obj_instance_make_new)
-#define mp_obj_is_native_type(type) ((type)->make_new != mp_obj_instance_make_new)
+#define mp_obj_is_instance_type(type) (MP_OBJ_TYPE_GET_SLOT_OR_NULL(type, make_new) == mp_obj_instance_make_new)
+#define mp_obj_is_native_type(type) (MP_OBJ_TYPE_GET_SLOT_OR_NULL(type, make_new) != mp_obj_instance_make_new)
// this needs to be exposed for the above macros to work correctly
mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
diff --git a/py/objzip.c b/py/objzip.c
index 34d73465ef..3c3138180a 100644
--- a/py/objzip.c
+++ b/py/objzip.c
@@ -70,6 +70,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_zip,
MP_QSTR_zip,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
- zip_make_new,
+ make_new, zip_make_new,
iter, zip_iternext
);
diff --git a/py/profile.c b/py/profile.c
index 2b9531e245..fd2d61caa9 100644
--- a/py/profile.c
+++ b/py/profile.c
@@ -176,7 +176,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_settrace_codeobj,
MP_QSTR_code,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, code_print,
unary_op, mp_generic_unary_op,
attr, code_attr
@@ -247,7 +246,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_type_frame,
MP_QSTR_frame,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
print, frame_print,
unary_op, mp_generic_unary_op,
attr, frame_attr
diff --git a/py/runtime.c b/py/runtime.c
index ec628bfe14..da6c86d971 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1076,7 +1076,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
mp_type_checked_fun,
MP_QSTR_function,
MP_TYPE_FLAG_BINDS_SELF,
- MP_TYPE_NULL_MAKE_NEW,
call, checked_fun_call
);
diff --git a/shared/runtime/mpirq.c b/shared/runtime/mpirq.c
index 889fa7a9a8..f9a85ebbd6 100644
--- a/shared/runtime/mpirq.c
+++ b/shared/runtime/mpirq.c
@@ -129,7 +129,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
mp_irq_type,
MP_QSTR_irq,
MP_TYPE_FLAG_NONE,
- MP_TYPE_NULL_MAKE_NEW,
call, mp_irq_call,
locals_dict, &mp_irq_locals_dict
);
diff --git a/shared/runtime/sys_stdio_mphal.c b/shared/runtime/sys_stdio_mphal.c
index 325f93dde1..ab5bdd34e7 100644
--- a/shared/runtime/sys_stdio_mphal.c
+++ b/shared/runtime/sys_stdio_mphal.c
@@ -127,7 +127,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
stdio_obj_type,
MP_QSTR_FileIO,
MP_TYPE_FLAG_ITER_IS_STREAM,
- MP_TYPE_NULL_MAKE_NEW,
print, stdio_obj_print,
protocol, &stdio_obj_stream_p,
locals_dict, &stdio_locals_dict
@@ -161,7 +160,6 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
stdio_buffer_obj_type,
MP_QSTR_FileIO,
MP_TYPE_FLAG_ITER_IS_STREAM,
- MP_TYPE_NULL_MAKE_NEW,
print, stdio_obj_print,
protocol, &stdio_buffer_obj_stream_p,
locals_dict, &stdio_locals_dict