From e62db5adcdb6f7d3353a000e41383cbe34c70e02 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 19 Oct 2023 14:27:20 -0700 Subject: [PATCH] Fix native property setting from subclass --- extmod/vfs_fat.c | 2 +- ports/atmel-samd/bindings/samd/Clock.c | 2 +- .../broadcom/bindings/videocore/Framebuffer.c | 2 +- ports/espressif/bindings/espcamera/Camera.c | 2 +- ports/espressif/bindings/espnow/ESPNow.c | 2 +- ports/espressif/bindings/espnow/Peer.c | 2 +- ports/espressif/bindings/espulp/ULP.c | 2 +- .../bindings/picodvi/Framebuffer.c | 2 +- .../bindings/rp2pio/StateMachine.c | 2 +- ports/unix/main.c | 3 + ports/unix/native_base_class.c | 71 +++++++++++++++++++ .../unix/variants/coverage/mpconfigvariant.mk | 3 +- py/objproperty.h | 6 ++ py/objtype.c | 7 +- py/runtime.c | 10 +++ shared-bindings/_bleio/Adapter.c | 2 +- shared-bindings/_bleio/Address.c | 2 +- shared-bindings/_bleio/Characteristic.c | 2 +- shared-bindings/_bleio/CharacteristicBuffer.c | 2 +- shared-bindings/_bleio/Connection.c | 2 +- shared-bindings/_bleio/Descriptor.c | 2 +- shared-bindings/_bleio/PacketBuffer.c | 2 +- shared-bindings/_bleio/ScanEntry.c | 2 +- shared-bindings/_bleio/Service.c | 2 +- shared-bindings/_bleio/UUID.c | 2 +- shared-bindings/_pixelmap/PixelMap.c | 2 +- shared-bindings/adafruit_pixelbuf/PixelBuf.c | 2 +- shared-bindings/aesio/aes.c | 2 +- shared-bindings/alarm/pin/PinAlarm.c | 2 +- shared-bindings/alarm/time/TimeAlarm.c | 2 +- shared-bindings/alarm/touch/TouchAlarm.c | 2 +- shared-bindings/analogio/AnalogIn.c | 2 +- shared-bindings/analogio/AnalogOut.c | 2 +- shared-bindings/audiobusio/I2SOut.c | 2 +- shared-bindings/audiobusio/PDMIn.c | 2 +- shared-bindings/audiocore/RawSample.c | 2 +- shared-bindings/audiocore/WaveFile.c | 2 +- shared-bindings/audioio/AudioOut.c | 2 +- shared-bindings/audiomixer/Mixer.c | 2 +- shared-bindings/audiomixer/MixerVoice.c | 2 +- shared-bindings/audiomp3/MP3Decoder.c | 2 +- shared-bindings/audiopwmio/PWMAudioOut.c | 2 +- shared-bindings/busdisplay/BusDisplay.c | 2 +- shared-bindings/busio/SPI.c | 2 +- shared-bindings/busio/UART.c | 2 +- shared-bindings/canio/CAN.c | 2 +- shared-bindings/canio/Listener.c | 2 +- shared-bindings/canio/Match.c | 2 +- shared-bindings/canio/Message.c | 2 +- .../canio/RemoteTransmissionRequest.c | 2 +- shared-bindings/countio/Counter.c | 2 +- shared-bindings/digitalio/DigitalInOut.c | 2 +- shared-bindings/displayio/Bitmap.c | 2 +- shared-bindings/displayio/ColorConverter.c | 2 +- shared-bindings/displayio/Group.c | 2 +- shared-bindings/displayio/OnDiskBitmap.c | 2 +- shared-bindings/displayio/Palette.c | 2 +- shared-bindings/displayio/TileGrid.c | 2 +- .../dotclockframebuffer/DotClockFramebuffer.c | 2 +- shared-bindings/epaperdisplay/EPaperDisplay.c | 2 +- shared-bindings/fontio/BuiltinFont.c | 2 +- .../framebufferio/FramebufferDisplay.c | 2 +- shared-bindings/frequencyio/FrequencyIn.c | 2 +- shared-bindings/gifio/OnDiskGif.c | 2 +- shared-bindings/gnss/GNSS.c | 2 +- shared-bindings/hashlib/Hash.c | 2 +- shared-bindings/ipaddress/IPv4Address.c | 2 +- shared-bindings/is31fl3741/FrameBuffer.c | 2 +- shared-bindings/keypad/Event.c | 2 +- shared-bindings/keypad/EventQueue.c | 2 +- shared-bindings/mdns/RemoteService.c | 2 +- shared-bindings/mdns/Server.c | 2 +- .../memorymonitor/AllocationSize.c | 2 +- shared-bindings/microcontroller/Processor.c | 2 +- shared-bindings/msgpack/ExtType.c | 2 +- shared-bindings/pulseio/PulseIn.c | 2 +- shared-bindings/pwmio/PWMOut.c | 2 +- shared-bindings/qrio/QRDecoder.c | 2 +- shared-bindings/rgbmatrix/RGBMatrix.c | 2 +- shared-bindings/rotaryio/IncrementalEncoder.c | 2 +- shared-bindings/rtc/RTC.c | 2 +- shared-bindings/sdioio/SDCard.c | 2 +- shared-bindings/ssl/SSLContext.c | 2 +- shared-bindings/supervisor/Runtime.c | 2 +- shared-bindings/supervisor/StatusBar.c | 2 +- shared-bindings/synthio/LFO.c | 2 +- shared-bindings/synthio/Math.c | 2 +- shared-bindings/synthio/MidiTrack.c | 2 +- shared-bindings/synthio/Note.c | 2 +- shared-bindings/synthio/Synthesizer.c | 2 +- shared-bindings/touchio/TouchIn.c | 2 +- shared-bindings/usb/core/Device.c | 2 +- shared-bindings/usb_cdc/Serial.c | 2 +- shared-bindings/usb_hid/Device.c | 2 +- shared-bindings/vectorio/Circle.c | 2 +- shared-bindings/vectorio/Polygon.c | 2 +- shared-bindings/vectorio/VectorShape.c | 2 +- shared-bindings/watchdog/WatchDogTimer.c | 2 +- shared-bindings/wifi/Monitor.c | 2 +- shared-bindings/wifi/Network.c | 2 +- shared-bindings/wifi/Radio.c | 2 +- tests/unix/subclass_native.py | 45 ++++++++++++ tests/unix/subclass_native.py.exp | 11 +++ 103 files changed, 249 insertions(+), 97 deletions(-) create mode 100644 ports/unix/native_base_class.c create mode 100644 tests/unix/subclass_native.py create mode 100644 tests/unix/subclass_native.py.exp diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index 9c0da3cda6..27d8187e71 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -540,7 +540,7 @@ STATIC const mp_vfs_proto_t fat_vfs_proto = { MP_DEFINE_CONST_OBJ_TYPE( mp_fat_vfs_type, MP_QSTR_VfsFat, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, fat_vfs_make_new, protocol, &fat_vfs_proto, locals_dict, &fat_vfs_locals_dict diff --git a/ports/atmel-samd/bindings/samd/Clock.c b/ports/atmel-samd/bindings/samd/Clock.c index fb8dd366d6..f483cfe376 100644 --- a/ports/atmel-samd/bindings/samd/Clock.c +++ b/ports/atmel-samd/bindings/samd/Clock.c @@ -131,7 +131,7 @@ STATIC MP_DEFINE_CONST_DICT(samd_clock_locals_dict, samd_clock_locals_dict_table MP_DEFINE_CONST_OBJ_TYPE( samd_clock_type, MP_QSTR_Clock, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, print, samd_clock_print, locals_dict, &samd_clock_locals_dict ); diff --git a/ports/broadcom/bindings/videocore/Framebuffer.c b/ports/broadcom/bindings/videocore/Framebuffer.c index 7239456d3e..0816e31aed 100644 --- a/ports/broadcom/bindings/videocore/Framebuffer.c +++ b/ports/broadcom/bindings/videocore/Framebuffer.c @@ -172,7 +172,7 @@ STATIC const framebuffer_p_t videocore_framebuffer_proto = { MP_DEFINE_CONST_OBJ_TYPE( videocore_framebuffer_type, MP_QSTR_Framebuffer, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, (mp_obj_dict_t *)&videocore_framebuffer_locals_dict, make_new, videocore_framebuffer_make_new, buffer, common_hal_videocore_framebuffer_get_buffer, diff --git a/ports/espressif/bindings/espcamera/Camera.c b/ports/espressif/bindings/espcamera/Camera.c index aea4cc775b..8e02d80f22 100644 --- a/ports/espressif/bindings/espcamera/Camera.c +++ b/ports/espressif/bindings/espcamera/Camera.c @@ -995,7 +995,7 @@ STATIC MP_DEFINE_CONST_DICT(espcamera_camera_locals_dict, espcamera_camera_local MP_DEFINE_CONST_OBJ_TYPE( espcamera_camera_type, MP_QSTR_Camera, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, espcamera_camera_make_new, locals_dict, &espcamera_camera_locals_dict ); diff --git a/ports/espressif/bindings/espnow/ESPNow.c b/ports/espressif/bindings/espnow/ESPNow.c index 1f544758d1..08ed4087ba 100644 --- a/ports/espressif/bindings/espnow/ESPNow.c +++ b/ports/espressif/bindings/espnow/ESPNow.c @@ -362,7 +362,7 @@ STATIC mp_obj_t espnow_unary_op(mp_unary_op_t op, mp_obj_t self_in) { MP_DEFINE_CONST_OBJ_TYPE( espnow_type, MP_QSTR_ESPNow, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, espnow_make_new, locals_dict, &espnow_locals_dict, protocol, &espnow_stream_p, diff --git a/ports/espressif/bindings/espnow/Peer.c b/ports/espressif/bindings/espnow/Peer.c index 9f6b46ac8e..cfe49954ff 100644 --- a/ports/espressif/bindings/espnow/Peer.c +++ b/ports/espressif/bindings/espnow/Peer.c @@ -225,7 +225,7 @@ STATIC MP_DEFINE_CONST_DICT(espnow_peer_locals_dict, espnow_peer_locals_dict_tab MP_DEFINE_CONST_OBJ_TYPE( espnow_peer_type, MP_QSTR_Peer, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, espnow_peer_make_new, locals_dict, &espnow_peer_locals_dict ); diff --git a/ports/espressif/bindings/espulp/ULP.c b/ports/espressif/bindings/espulp/ULP.c index 4e9c331758..9fd3be4297 100644 --- a/ports/espressif/bindings/espulp/ULP.c +++ b/ports/espressif/bindings/espulp/ULP.c @@ -175,7 +175,7 @@ STATIC MP_DEFINE_CONST_DICT(espulp_ulp_locals_dict, espulp_ulp_locals_table); MP_DEFINE_CONST_OBJ_TYPE( espulp_ulp_type, MP_QSTR_ULP, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, espulp_ulp_make_new, locals_dict, &espulp_ulp_locals_dict ); diff --git a/ports/raspberrypi/bindings/picodvi/Framebuffer.c b/ports/raspberrypi/bindings/picodvi/Framebuffer.c index c327ce284d..8a34a90b8b 100644 --- a/ports/raspberrypi/bindings/picodvi/Framebuffer.c +++ b/ports/raspberrypi/bindings/picodvi/Framebuffer.c @@ -251,7 +251,7 @@ STATIC const framebuffer_p_t picodvi_framebuffer_proto = { MP_DEFINE_CONST_OBJ_TYPE( picodvi_framebuffer_type, MP_QSTR_Framebuffer, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &picodvi_framebuffer_locals_dict, make_new, picodvi_framebuffer_make_new, buffer, common_hal_picodvi_framebuffer_get_buffer, diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index 120145f5ea..37a3fd6f7f 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -862,7 +862,7 @@ STATIC MP_DEFINE_CONST_DICT(rp2pio_statemachine_locals_dict, rp2pio_statemachine MP_DEFINE_CONST_OBJ_TYPE( rp2pio_statemachine_type, MP_QSTR_StateMachine, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, rp2pio_statemachine_make_new, locals_dict, &rp2pio_statemachine_locals_dict ); diff --git a/ports/unix/main.c b/ports/unix/main.c index d9a7c0ed35..cc876970af 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -593,6 +593,9 @@ MP_NOINLINE int main_(int argc, char **argv) { MP_DECLARE_CONST_FUN_OBJ_0(extra_cpp_coverage_obj); mp_store_global(MP_QSTR_extra_coverage, MP_OBJ_FROM_PTR(&extra_coverage_obj)); mp_store_global(MP_QSTR_extra_cpp_coverage, MP_OBJ_FROM_PTR(&extra_cpp_coverage_obj)); + // CIRCUITPY-CHANGE: test native base classes work as needed by CircuitPython libraries. + extern const mp_obj_type_t native_base_class_type; + mp_store_global(MP_QSTR_NativeBaseClass, MP_OBJ_FROM_PTR(&native_base_class_type)); } #endif diff --git a/ports/unix/native_base_class.c b/ports/unix/native_base_class.c new file mode 100644 index 0000000000..88165ef645 --- /dev/null +++ b/ports/unix/native_base_class.c @@ -0,0 +1,71 @@ +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/objtype.h" +#include "py/runtime.h" + +#if defined(MICROPY_UNIX_COVERAGE) + +// This is a native base class that is used in tests. + +typedef struct { + mp_obj_base_t base; + mp_obj_t test; +} native_base_class_obj_t; + +const mp_obj_type_t native_base_class_type; + +STATIC mp_obj_t native_base_class_make_new(const mp_obj_type_t *type, size_t n_args, + size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_test }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_test, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + native_base_class_obj_t *self = mp_obj_malloc(native_base_class_obj_t, &native_base_class_type); + self->test = args[ARG_test].u_obj; + return MP_OBJ_FROM_PTR(self); +} + +// Helper to ensure we have the native super class instead of a subclass. +static native_base_class_obj_t *native_base(mp_obj_t unknown_obj) { + mp_obj_t native_obj = mp_obj_cast_to_native_base(unknown_obj, &native_base_class_type); + mp_obj_assert_native_inited(native_obj); + return MP_OBJ_TO_PTR(native_obj); +} + +STATIC mp_obj_t native_base_class_obj_get_test(mp_obj_t self_in) { + native_base_class_obj_t *self = native_base(self_in); + return self->test; +} +MP_DEFINE_CONST_FUN_OBJ_1(native_base_class_get_test_obj, native_base_class_obj_get_test); + +STATIC mp_obj_t native_base_class_obj_set_test(mp_obj_t self_in, mp_obj_t value) { + mp_printf(&mp_plat_print, "native base class .test set to: "); + mp_obj_print_helper(&mp_plat_print, value, PRINT_REPR); + mp_printf(&mp_plat_print, "\n"); + native_base_class_obj_t *self = native_base(self_in); + self->test = value; + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(native_base_class_set_test_obj, native_base_class_obj_set_test); + +MP_PROPERTY_GETSET(native_base_class_test_obj, + (mp_obj_t)&native_base_class_get_test_obj, + (mp_obj_t)&native_base_class_set_test_obj); + +STATIC const mp_rom_map_elem_t native_base_class_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_test), MP_ROM_PTR(&native_base_class_test_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(native_base_class_locals_dict, native_base_class_locals_dict_table); + +MP_DEFINE_CONST_OBJ_TYPE( + native_base_class_type, + MP_QSTR_NativeBaseClass, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, + make_new, &native_base_class_make_new, + locals_dict, &native_base_class_locals_dict + ); + +#endif diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk index e19a136194..f48084e9dd 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.mk +++ b/ports/unix/variants/coverage/mpconfigvariant.mk @@ -90,6 +90,7 @@ CFLAGS += \ -DCIRCUITPY_TRACEBACK=1 \ -DCIRCUITPY_ZLIB=1 -SRC_C += coverage.c +# CIRCUITPY-CHANGE: test native base classes. +SRC_C += coverage.c native_base_class.c SRC_CXX += coveragecpp.cpp CIRCUITPY_MESSAGE_COMPRESSION_LEVEL = 1 diff --git a/py/objproperty.h b/py/objproperty.h index c1b5dba460..0098bfd0b1 100644 --- a/py/objproperty.h +++ b/py/objproperty.h @@ -28,6 +28,12 @@ #include "py/obj.h" +// CIRCUITPY-CHANGE: MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS marks classes with +// properties, descriptors, __delattr__ or __setattr___. +// When defining native classes that use properties, you *must* set the +// MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS flag. Otherwise, the property will be +// ignored. + #if MICROPY_PY_BUILTINS_PROPERTY typedef struct _mp_obj_property_t { diff --git a/py/objtype.c b/py/objtype.c index 8716c7cc12..213c5e3838 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -193,6 +193,10 @@ STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_t // do a lookup, not a (base) type in which we found the class method. const mp_obj_type_t *org_type = (const mp_obj_type_t *)lookup->obj; mp_convert_member_lookup(MP_OBJ_NULL, org_type, elem->value, lookup->dest); + } else if (mp_obj_is_type(elem->value, &mp_type_property)) { + // CIRCUITPY-CHANGE: CircuitPython uses properties on native classes, so we always return them. + lookup->dest[0] = elem->value; + return; } else { mp_obj_instance_t *obj = lookup->obj; mp_obj_t obj_obj; @@ -1172,9 +1176,10 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict) #endif } #if ENABLE_SPECIAL_ACCESSORS + // Inherit the special accessors flag. + base_flags |= t->flags & MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS; if (mp_obj_is_instance_type(t)) { t->flags |= MP_TYPE_FLAG_IS_SUBCLASSED; - base_flags |= t->flags & MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS; } #endif } diff --git a/py/runtime.c b/py/runtime.c index a488949e74..5b205cd764 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1241,6 +1241,16 @@ void mp_load_method_maybe(mp_obj_t obj, qstr attr, mp_obj_t *dest) { mp_map_t *locals_map = &MP_OBJ_TYPE_GET_SLOT(type, locals_dict)->map; mp_map_elem_t *elem = mp_map_lookup(locals_map, MP_OBJ_NEW_QSTR(attr), MP_MAP_LOOKUP); if (elem != NULL) { + // CIRCUITPY-CHANGE: Validate flag + #if MICROPY_PY_BUILTINS_PROPERTY + // Validate that the type has the correct flag for properties. It is manually + // managed for native types. If the flag is missing, then act like the + // attribute doesn't exist. + if (mp_obj_is_type(elem->value, &mp_type_property) && (type->flags & MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS) == 0) { + dest[1] = MP_OBJ_NULL; + return; + } + #endif mp_convert_member_lookup(obj, type, elem->value, dest); } return; diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 6b90258111..fcc5959491 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -471,7 +471,7 @@ STATIC MP_DEFINE_CONST_DICT(bleio_adapter_locals_dict, bleio_adapter_locals_dict MP_DEFINE_CONST_OBJ_TYPE( bleio_adapter_type, MP_QSTR_Adapter, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, bleio_adapter_make_new, locals_dict, &bleio_adapter_locals_dict ); diff --git a/shared-bindings/_bleio/Address.c b/shared-bindings/_bleio/Address.c index 623bc7aaed..977d731a3e 100644 --- a/shared-bindings/_bleio/Address.c +++ b/shared-bindings/_bleio/Address.c @@ -202,7 +202,7 @@ STATIC MP_DEFINE_CONST_DICT(bleio_address_locals_dict, bleio_address_locals_dict MP_DEFINE_CONST_OBJ_TYPE( bleio_address_type, MP_QSTR_Address, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, bleio_address_make_new, print, bleio_address_print, locals_dict, &bleio_address_locals_dict, diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index 8b14acd7df..1dbf7f4a08 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -328,7 +328,7 @@ STATIC void bleio_characteristic_print(const mp_print_t *print, mp_obj_t self_in MP_DEFINE_CONST_OBJ_TYPE( bleio_characteristic_type, MP_QSTR_Characteristic, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, print, bleio_characteristic_print, locals_dict, &bleio_characteristic_locals_dict ); diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c index 474a07f7b9..b5a35ac095 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -225,7 +225,7 @@ STATIC const mp_stream_p_t characteristic_buffer_stream_p = { MP_DEFINE_CONST_OBJ_TYPE( bleio_characteristic_buffer_type, MP_QSTR_CharacteristicBuffer, - MP_TYPE_FLAG_ITER_IS_ITERNEXT, + MP_TYPE_FLAG_ITER_IS_ITERNEXT | MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, bleio_characteristic_buffer_make_new, locals_dict, &bleio_characteristic_buffer_locals_dict, iter, mp_stream_unbuffered_iter, diff --git a/shared-bindings/_bleio/Connection.c b/shared-bindings/_bleio/Connection.c index 6f67996103..1f33749438 100644 --- a/shared-bindings/_bleio/Connection.c +++ b/shared-bindings/_bleio/Connection.c @@ -247,6 +247,6 @@ STATIC MP_DEFINE_CONST_DICT(bleio_connection_locals_dict, bleio_connection_local MP_DEFINE_CONST_OBJ_TYPE( bleio_connection_type, MP_QSTR_Connection, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &bleio_connection_locals_dict ); diff --git a/shared-bindings/_bleio/Descriptor.c b/shared-bindings/_bleio/Descriptor.c index 093b51100e..fd28e924e8 100644 --- a/shared-bindings/_bleio/Descriptor.c +++ b/shared-bindings/_bleio/Descriptor.c @@ -214,7 +214,7 @@ STATIC void bleio_descriptor_print(const mp_print_t *print, mp_obj_t self_in, mp MP_DEFINE_CONST_OBJ_TYPE( bleio_descriptor_type, MP_QSTR_Descriptor, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, print, bleio_descriptor_print, locals_dict, &bleio_descriptor_locals_dict ); diff --git a/shared-bindings/_bleio/PacketBuffer.c b/shared-bindings/_bleio/PacketBuffer.c index c97e97b410..fbdb5ffc2b 100644 --- a/shared-bindings/_bleio/PacketBuffer.c +++ b/shared-bindings/_bleio/PacketBuffer.c @@ -232,7 +232,7 @@ STATIC MP_DEFINE_CONST_DICT(bleio_packet_buffer_locals_dict, bleio_packet_buffer MP_DEFINE_CONST_OBJ_TYPE( bleio_packet_buffer_type, MP_QSTR_PacketBuffer, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, bleio_packet_buffer_make_new, locals_dict, &bleio_packet_buffer_locals_dict ); diff --git a/shared-bindings/_bleio/ScanEntry.c b/shared-bindings/_bleio/ScanEntry.c index f859f22be1..f03048e7c4 100644 --- a/shared-bindings/_bleio/ScanEntry.c +++ b/shared-bindings/_bleio/ScanEntry.c @@ -139,6 +139,6 @@ STATIC MP_DEFINE_CONST_DICT(bleio_scanentry_locals_dict, bleio_scanentry_locals_ MP_DEFINE_CONST_OBJ_TYPE( bleio_scanentry_type, MP_QSTR_ScanEntry, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &bleio_scanentry_locals_dict ); diff --git a/shared-bindings/_bleio/Service.c b/shared-bindings/_bleio/Service.c index f5ffa982f6..22475f35f6 100644 --- a/shared-bindings/_bleio/Service.c +++ b/shared-bindings/_bleio/Service.c @@ -143,7 +143,7 @@ STATIC void bleio_service_print(const mp_print_t *print, mp_obj_t self_in, mp_pr MP_DEFINE_CONST_OBJ_TYPE( bleio_service_type, MP_QSTR_Service, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, bleio_service_make_new, print, bleio_service_print, locals_dict, &bleio_service_locals_dict diff --git a/shared-bindings/_bleio/UUID.c b/shared-bindings/_bleio/UUID.c index c177e096f5..5bb668553b 100644 --- a/shared-bindings/_bleio/UUID.c +++ b/shared-bindings/_bleio/UUID.c @@ -283,7 +283,7 @@ void bleio_uuid_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t MP_DEFINE_CONST_OBJ_TYPE( bleio_uuid_type, MP_QSTR_UUID, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, print, bleio_uuid_print, make_new, bleio_uuid_make_new, locals_dict, &bleio_uuid_locals_dict, diff --git a/shared-bindings/_pixelmap/PixelMap.c b/shared-bindings/_pixelmap/PixelMap.c index 4d06fe64fa..6297ef38f4 100644 --- a/shared-bindings/_pixelmap/PixelMap.c +++ b/shared-bindings/_pixelmap/PixelMap.c @@ -258,7 +258,7 @@ STATIC MP_DEFINE_CONST_DICT(pixelmap_pixelmap_locals_dict, pixelmap_pixelmap_loc MP_DEFINE_CONST_OBJ_TYPE( pixelmap_pixelmap_type, MP_QSTR_PixelMap, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &pixelmap_pixelmap_locals_dict, make_new, pixelmap_pixelmap_make_new, subscr, pixelmap_pixelmap_subscr, diff --git a/shared-bindings/adafruit_pixelbuf/PixelBuf.c b/shared-bindings/adafruit_pixelbuf/PixelBuf.c index 20455026b4..a7970366a5 100644 --- a/shared-bindings/adafruit_pixelbuf/PixelBuf.c +++ b/shared-bindings/adafruit_pixelbuf/PixelBuf.c @@ -371,7 +371,7 @@ STATIC MP_DEFINE_CONST_DICT(pixelbuf_pixelbuf_locals_dict, pixelbuf_pixelbuf_loc MP_DEFINE_CONST_OBJ_TYPE( pixelbuf_pixelbuf_type, MP_QSTR_PixelBuf, - MP_TYPE_FLAG_ITER_IS_GETITER, + MP_TYPE_FLAG_ITER_IS_GETITER | MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &pixelbuf_pixelbuf_locals_dict, make_new, pixelbuf_pixelbuf_make_new, subscr, pixelbuf_pixelbuf_subscr, diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index 8344c43c9b..3d8758346d 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -252,7 +252,7 @@ STATIC MP_DEFINE_CONST_DICT(aesio_locals_dict, aesio_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( aesio_aes_type, MP_QSTR_AES, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, aesio_aes_make_new, locals_dict, &aesio_locals_dict ); diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index 2e9441c725..4d7e9ed495 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -120,7 +120,7 @@ STATIC MP_DEFINE_CONST_DICT(alarm_pin_pinalarm_locals_dict, alarm_pin_pinalarm_l MP_DEFINE_CONST_OBJ_TYPE( alarm_pin_pinalarm_type, MP_QSTR_PinAlarm, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, alarm_pin_pinalarm_make_new, locals_dict, &alarm_pin_pinalarm_locals_dict ); diff --git a/shared-bindings/alarm/time/TimeAlarm.c b/shared-bindings/alarm/time/TimeAlarm.c index 9a6440d451..960f93d1c0 100644 --- a/shared-bindings/alarm/time/TimeAlarm.c +++ b/shared-bindings/alarm/time/TimeAlarm.c @@ -134,7 +134,7 @@ STATIC MP_DEFINE_CONST_DICT(alarm_time_timealarm_locals_dict, alarm_time_timeala MP_DEFINE_CONST_OBJ_TYPE( alarm_time_timealarm_type, MP_QSTR_TimeAlarm, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, alarm_time_timealarm_make_new, locals_dict, &alarm_time_timealarm_locals_dict ); diff --git a/shared-bindings/alarm/touch/TouchAlarm.c b/shared-bindings/alarm/touch/TouchAlarm.c index 6433e1d845..2c2bb97327 100644 --- a/shared-bindings/alarm/touch/TouchAlarm.c +++ b/shared-bindings/alarm/touch/TouchAlarm.c @@ -82,7 +82,7 @@ STATIC MP_DEFINE_CONST_DICT(alarm_touch_touchalarm_locals_dict, alarm_touch_touc MP_DEFINE_CONST_OBJ_TYPE( alarm_touch_touchalarm_type, MP_QSTR_TouchAlarm, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, alarm_touch_touchalarm_make_new, locals_dict, &alarm_touch_touchalarm_locals_dict ); diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index c99d48fd56..cff9e10b89 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -152,7 +152,7 @@ STATIC MP_DEFINE_CONST_DICT(analogio_analogin_locals_dict, analogio_analogin_loc MP_DEFINE_CONST_OBJ_TYPE( analogio_analogin_type, MP_QSTR_AnalogIn, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, analogio_analogin_make_new, locals_dict, &analogio_analogin_locals_dict ); diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index facf45cf98..0c6ca73670 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -133,7 +133,7 @@ STATIC MP_DEFINE_CONST_DICT(analogio_analogout_locals_dict, analogio_analogout_l MP_DEFINE_CONST_OBJ_TYPE( analogio_analogout_type, MP_QSTR_AnalogOut, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, analogio_analogout_make_new, locals_dict, &analogio_analogout_locals_dict ); diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index 1306e423c2..d3b722ebcb 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -275,7 +275,7 @@ STATIC MP_DEFINE_CONST_DICT(audiobusio_i2sout_locals_dict, audiobusio_i2sout_loc MP_DEFINE_CONST_OBJ_TYPE( audiobusio_i2sout_type, MP_QSTR_I2SOut, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, audiobusio_i2sout_make_new, locals_dict, &audiobusio_i2sout_locals_dict ); diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index 601b0c2f84..118ba69177 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -244,7 +244,7 @@ STATIC MP_DEFINE_CONST_DICT(audiobusio_pdmin_locals_dict, audiobusio_pdmin_local MP_DEFINE_CONST_OBJ_TYPE( audiobusio_pdmin_type, MP_QSTR_PDMIn, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, audiobusio_pdmin_make_new #if CIRCUITPY_AUDIOBUSIO_PDMIN , locals_dict, &audiobusio_pdmin_locals_dict diff --git a/shared-bindings/audiocore/RawSample.c b/shared-bindings/audiocore/RawSample.c index 265515c3e1..46f5d4c748 100644 --- a/shared-bindings/audiocore/RawSample.c +++ b/shared-bindings/audiocore/RawSample.c @@ -177,7 +177,7 @@ STATIC const audiosample_p_t audioio_rawsample_proto = { MP_DEFINE_CONST_OBJ_TYPE( audioio_rawsample_type, MP_QSTR_RawSample, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, audioio_rawsample_make_new, locals_dict, &audioio_rawsample_locals_dict, protocol, &audioio_rawsample_proto diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index a07e74809a..98a0a564f8 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -203,7 +203,7 @@ STATIC const audiosample_p_t audioio_wavefile_proto = { MP_DEFINE_CONST_OBJ_TYPE( audioio_wavefile_type, MP_QSTR_WaveFile, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, audioio_wavefile_make_new, locals_dict, &audioio_wavefile_locals_dict, protocol, &audioio_wavefile_proto diff --git a/shared-bindings/audioio/AudioOut.c b/shared-bindings/audioio/AudioOut.c index 3df62dbe02..72b7828c48 100644 --- a/shared-bindings/audioio/AudioOut.c +++ b/shared-bindings/audioio/AudioOut.c @@ -261,7 +261,7 @@ STATIC MP_DEFINE_CONST_DICT(audioio_audioout_locals_dict, audioio_audioout_local MP_DEFINE_CONST_OBJ_TYPE( audioio_audioout_type, MP_QSTR_AudioOut, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, audioio_audioout_make_new, locals_dict, &audioio_audioout_locals_dict ); diff --git a/shared-bindings/audiomixer/Mixer.c b/shared-bindings/audiomixer/Mixer.c index 3698dc4b7e..03d21728dc 100644 --- a/shared-bindings/audiomixer/Mixer.c +++ b/shared-bindings/audiomixer/Mixer.c @@ -275,7 +275,7 @@ STATIC const audiosample_p_t audiomixer_mixer_proto = { MP_DEFINE_CONST_OBJ_TYPE( audiomixer_mixer_type, MP_QSTR_Mixer, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, audiomixer_mixer_make_new, locals_dict, &audiomixer_mixer_locals_dict, protocol, &audiomixer_mixer_proto diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index aaa5aedb58..e2d00ebc5b 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -156,7 +156,7 @@ STATIC MP_DEFINE_CONST_DICT(audiomixer_mixervoice_locals_dict, audiomixer_mixerv MP_DEFINE_CONST_OBJ_TYPE( audiomixer_mixervoice_type, MP_QSTR_MixerVoice, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, audiomixer_mixervoice_make_new, locals_dict, &audiomixer_mixervoice_locals_dict ); diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index 1acab44a61..b27383aa98 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -286,7 +286,7 @@ STATIC const audiosample_p_t audiomp3_mp3file_proto = { MP_DEFINE_CONST_OBJ_TYPE( audiomp3_mp3file_type, MP_QSTR_MP3Decoder, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, audiomp3_mp3file_make_new, locals_dict, &audiomp3_mp3file_locals_dict, protocol, &audiomp3_mp3file_proto diff --git a/shared-bindings/audiopwmio/PWMAudioOut.c b/shared-bindings/audiopwmio/PWMAudioOut.c index f0837b5620..b7d2a6d8a0 100644 --- a/shared-bindings/audiopwmio/PWMAudioOut.c +++ b/shared-bindings/audiopwmio/PWMAudioOut.c @@ -271,7 +271,7 @@ STATIC MP_DEFINE_CONST_DICT(audiopwmio_pwmaudioout_locals_dict, audiopwmio_pwmau MP_DEFINE_CONST_OBJ_TYPE( audiopwmio_pwmaudioout_type, MP_QSTR_PWMAudioOut, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, audiopwmio_pwmaudioout_make_new, locals_dict, &audiopwmio_pwmaudioout_locals_dict ); diff --git a/shared-bindings/busdisplay/BusDisplay.c b/shared-bindings/busdisplay/BusDisplay.c index c216163ed4..f5571f4040 100644 --- a/shared-bindings/busdisplay/BusDisplay.c +++ b/shared-bindings/busdisplay/BusDisplay.c @@ -509,7 +509,7 @@ STATIC MP_DEFINE_CONST_DICT(busdisplay_busdisplay_locals_dict, busdisplay_busdis MP_DEFINE_CONST_OBJ_TYPE( busdisplay_busdisplay_type, MP_QSTR_BusDisplay, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, busdisplay_busdisplay_make_new, locals_dict, &busdisplay_busdisplay_locals_dict ); diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index 39dff26c3b..1f02927bb1 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -492,7 +492,7 @@ STATIC MP_DEFINE_CONST_DICT(busio_spi_locals_dict, busio_spi_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( busio_spi_type, MP_QSTR_SPI, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, busio_spi_make_new, locals_dict, &busio_spi_locals_dict ); diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index 3bb9d6eb78..1036534a61 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -465,7 +465,7 @@ STATIC const mp_stream_p_t uart_stream_p = { MP_DEFINE_CONST_OBJ_TYPE( busio_uart_type, MP_QSTR_UART, - MP_TYPE_FLAG_ITER_IS_ITERNEXT, + MP_TYPE_FLAG_ITER_IS_ITERNEXT | MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, busio_uart_make_new, locals_dict, &busio_uart_locals_dict, iter, mp_stream_unbuffered_iter, diff --git a/shared-bindings/canio/CAN.c b/shared-bindings/canio/CAN.c index f82b06216f..10fd752508 100644 --- a/shared-bindings/canio/CAN.c +++ b/shared-bindings/canio/CAN.c @@ -346,7 +346,7 @@ STATIC MP_DEFINE_CONST_DICT(canio_can_locals_dict, canio_can_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( canio_can_type, MP_QSTR_CAN, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, canio_can_make_new, locals_dict, &canio_can_locals_dict ); diff --git a/shared-bindings/canio/Listener.c b/shared-bindings/canio/Listener.c index ac28ea0df2..8e3de9c7e5 100644 --- a/shared-bindings/canio/Listener.c +++ b/shared-bindings/canio/Listener.c @@ -169,7 +169,7 @@ STATIC MP_DEFINE_CONST_DICT(canio_listener_locals_dict, canio_listener_locals_di MP_DEFINE_CONST_OBJ_TYPE( canio_listener_type, MP_QSTR_Listener, - MP_TYPE_FLAG_ITER_IS_ITERNEXT, + MP_TYPE_FLAG_ITER_IS_ITERNEXT | MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &canio_listener_locals_dict, iter, canio_iternext ); diff --git a/shared-bindings/canio/Match.c b/shared-bindings/canio/Match.c index 4ead5d75c2..2265ba8c46 100644 --- a/shared-bindings/canio/Match.c +++ b/shared-bindings/canio/Match.c @@ -116,7 +116,7 @@ STATIC MP_DEFINE_CONST_DICT(canio_match_locals_dict, canio_match_locals_dict_tab MP_DEFINE_CONST_OBJ_TYPE( canio_match_type, MP_QSTR_Match, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, canio_match_make_new, locals_dict, &canio_match_locals_dict ); diff --git a/shared-bindings/canio/Message.c b/shared-bindings/canio/Message.c index b53181e0dd..7f52e99346 100644 --- a/shared-bindings/canio/Message.c +++ b/shared-bindings/canio/Message.c @@ -139,7 +139,7 @@ STATIC MP_DEFINE_CONST_DICT(canio_message_locals_dict, canio_message_locals_dict MP_DEFINE_CONST_OBJ_TYPE( canio_message_type, MP_QSTR_Message, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, canio_message_make_new, locals_dict, &canio_message_locals_dict ); diff --git a/shared-bindings/canio/RemoteTransmissionRequest.c b/shared-bindings/canio/RemoteTransmissionRequest.c index 3920942bfe..22eb2c5bc7 100644 --- a/shared-bindings/canio/RemoteTransmissionRequest.c +++ b/shared-bindings/canio/RemoteTransmissionRequest.c @@ -139,7 +139,7 @@ STATIC MP_DEFINE_CONST_DICT(canio_remote_transmission_request_locals_dict, canio MP_DEFINE_CONST_OBJ_TYPE( canio_remote_transmission_request_type, MP_QSTR_RemoteTransmissionRequest, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, canio_remote_transmission_request_make_new, locals_dict, &canio_remote_transmission_request_locals_dict ); diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c index fc7a9ca11d..cd85d37b9c 100644 --- a/shared-bindings/countio/Counter.c +++ b/shared-bindings/countio/Counter.c @@ -148,7 +148,7 @@ STATIC MP_DEFINE_CONST_DICT(countio_counter_locals_dict, countio_counter_locals_ MP_DEFINE_CONST_OBJ_TYPE( countio_counter_type, MP_QSTR_Counter, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, countio_counter_make_new, locals_dict, &countio_counter_locals_dict ); diff --git a/shared-bindings/digitalio/DigitalInOut.c b/shared-bindings/digitalio/DigitalInOut.c index 07f6bc40a4..c73d552855 100644 --- a/shared-bindings/digitalio/DigitalInOut.c +++ b/shared-bindings/digitalio/DigitalInOut.c @@ -362,7 +362,7 @@ STATIC MP_DEFINE_CONST_DICT(digitalio_digitalinout_locals_dict, digitalio_digita MP_DEFINE_CONST_OBJ_TYPE( digitalio_digitalinout_type, MP_QSTR_DigitalInOut, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, digitalio_digitalinout_make_new, locals_dict, &digitalio_digitalinout_locals_dict ); diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index a7c93b5033..3d0479c612 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -291,7 +291,7 @@ STATIC mp_int_t bitmap_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, m MP_DEFINE_CONST_OBJ_TYPE( displayio_bitmap_type, MP_QSTR_Bitmap, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, displayio_bitmap_make_new, locals_dict, &displayio_bitmap_locals_dict, subscr, bitmap_subscr, diff --git a/shared-bindings/displayio/ColorConverter.c b/shared-bindings/displayio/ColorConverter.c index 8962a58fa8..ef863162a3 100644 --- a/shared-bindings/displayio/ColorConverter.c +++ b/shared-bindings/displayio/ColorConverter.c @@ -138,7 +138,7 @@ STATIC MP_DEFINE_CONST_DICT(displayio_colorconverter_locals_dict, displayio_colo MP_DEFINE_CONST_OBJ_TYPE( displayio_colorconverter_type, MP_QSTR_ColorConverter, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, displayio_colorconverter_make_new, locals_dict, &displayio_colorconverter_locals_dict ); diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 177d62f83a..3253a6adee 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -351,7 +351,7 @@ STATIC MP_DEFINE_CONST_DICT(displayio_group_locals_dict, displayio_group_locals_ MP_DEFINE_CONST_OBJ_TYPE( displayio_group_type, MP_QSTR_Group, - MP_TYPE_FLAG_ITER_IS_GETITER, + MP_TYPE_FLAG_ITER_IS_GETITER | MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, displayio_group_make_new, locals_dict, &displayio_group_locals_dict, subscr, group_subscr, diff --git a/shared-bindings/displayio/OnDiskBitmap.c b/shared-bindings/displayio/OnDiskBitmap.c index a8fd2658fa..d608a32d4b 100644 --- a/shared-bindings/displayio/OnDiskBitmap.c +++ b/shared-bindings/displayio/OnDiskBitmap.c @@ -151,7 +151,7 @@ STATIC MP_DEFINE_CONST_DICT(displayio_ondiskbitmap_locals_dict, displayio_ondisk MP_DEFINE_CONST_OBJ_TYPE( displayio_ondiskbitmap_type, MP_QSTR_OnDiskBitmap, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, displayio_ondiskbitmap_make_new, locals_dict, &displayio_ondiskbitmap_locals_dict ); diff --git a/shared-bindings/displayio/Palette.c b/shared-bindings/displayio/Palette.c index 2c0e7ee3a1..4d68c109be 100644 --- a/shared-bindings/displayio/Palette.c +++ b/shared-bindings/displayio/Palette.c @@ -218,7 +218,7 @@ STATIC MP_DEFINE_CONST_DICT(displayio_palette_locals_dict, displayio_palette_loc MP_DEFINE_CONST_OBJ_TYPE( displayio_palette_type, MP_QSTR_Palette, - MP_TYPE_FLAG_ITER_IS_GETITER, + MP_TYPE_FLAG_ITER_IS_GETITER | MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, displayio_palette_make_new, locals_dict, &displayio_palette_locals_dict, subscr, palette_subscr, diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index 4bc81a20dd..f7a47474bc 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -483,7 +483,7 @@ STATIC MP_DEFINE_CONST_DICT(displayio_tilegrid_locals_dict, displayio_tilegrid_l MP_DEFINE_CONST_OBJ_TYPE( displayio_tilegrid_type, MP_QSTR_TileGrid, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, displayio_tilegrid_make_new, locals_dict, &displayio_tilegrid_locals_dict, subscr, tilegrid_subscr diff --git a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c index 3a55166f8b..899fccf68a 100644 --- a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c +++ b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c @@ -385,7 +385,7 @@ STATIC MP_DEFINE_CONST_DICT(dotclockframebuffer_framebuffer_locals_dict, dotcloc MP_DEFINE_CONST_OBJ_TYPE( dotclockframebuffer_framebuffer_type, MP_QSTR_DotClockFramebuffer, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, dotclockframebuffer_framebuffer_make_new, locals_dict, &dotclockframebuffer_framebuffer_locals_dict, buffer, dotclockframebuffer_framebuffer_get_buffer, diff --git a/shared-bindings/epaperdisplay/EPaperDisplay.c b/shared-bindings/epaperdisplay/EPaperDisplay.c index eae82627c2..8c488fffcc 100644 --- a/shared-bindings/epaperdisplay/EPaperDisplay.c +++ b/shared-bindings/epaperdisplay/EPaperDisplay.c @@ -407,7 +407,7 @@ STATIC MP_DEFINE_CONST_DICT(epaperdisplay_epaperdisplay_locals_dict, epaperdispl MP_DEFINE_CONST_OBJ_TYPE( epaperdisplay_epaperdisplay_type, MP_QSTR_EPaperDisplay, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, epaperdisplay_epaperdisplay_make_new, locals_dict, &epaperdisplay_epaperdisplay_locals_dict ); diff --git a/shared-bindings/fontio/BuiltinFont.c b/shared-bindings/fontio/BuiltinFont.c index 53d92df995..d68e0ccc09 100644 --- a/shared-bindings/fontio/BuiltinFont.c +++ b/shared-bindings/fontio/BuiltinFont.c @@ -109,6 +109,6 @@ STATIC MP_DEFINE_CONST_DICT(fontio_builtinfont_locals_dict, fontio_builtinfont_l MP_DEFINE_CONST_OBJ_TYPE( fontio_builtinfont_type, MP_QSTR_BuiltinFont, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &fontio_builtinfont_locals_dict ); diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index dfbc41f6c8..370d2eacae 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -366,7 +366,7 @@ STATIC MP_DEFINE_CONST_DICT(framebufferio_framebufferdisplay_locals_dict, frameb MP_DEFINE_CONST_OBJ_TYPE( framebufferio_framebufferdisplay_type, MP_QSTR_FramebufferDisplay, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, framebufferio_framebufferdisplay_make_new, locals_dict, &framebufferio_framebufferdisplay_locals_dict ); diff --git a/shared-bindings/frequencyio/FrequencyIn.c b/shared-bindings/frequencyio/FrequencyIn.c index 569361a566..1cb46887a0 100644 --- a/shared-bindings/frequencyio/FrequencyIn.c +++ b/shared-bindings/frequencyio/FrequencyIn.c @@ -220,7 +220,7 @@ STATIC MP_DEFINE_CONST_DICT(frequencyio_frequencyin_locals_dict, frequencyio_fre MP_DEFINE_CONST_OBJ_TYPE( frequencyio_frequencyin_type, MP_QSTR_frequencyin, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, frequencyio_frequencyin_make_new, locals_dict, &frequencyio_frequencyin_locals_dict ); diff --git a/shared-bindings/gifio/OnDiskGif.c b/shared-bindings/gifio/OnDiskGif.c index a7a7b62dae..1fb75d6245 100644 --- a/shared-bindings/gifio/OnDiskGif.c +++ b/shared-bindings/gifio/OnDiskGif.c @@ -323,7 +323,7 @@ STATIC MP_DEFINE_CONST_DICT(gifio_ondiskgif_locals_dict, gifio_ondiskgif_locals_ MP_DEFINE_CONST_OBJ_TYPE( gifio_ondiskgif_type, MP_QSTR_OnDiskGif, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, gifio_ondiskgif_make_new, locals_dict, &gifio_ondiskgif_locals_dict ); diff --git a/shared-bindings/gnss/GNSS.c b/shared-bindings/gnss/GNSS.c index a3b2f464d9..07962a682e 100644 --- a/shared-bindings/gnss/GNSS.c +++ b/shared-bindings/gnss/GNSS.c @@ -172,7 +172,7 @@ STATIC MP_DEFINE_CONST_DICT(gnss_locals_dict, gnss_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( gnss_type, MP_QSTR_GNSS, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, gnss_make_new, locals_dict, &gnss_locals_dict ); diff --git a/shared-bindings/hashlib/Hash.c b/shared-bindings/hashlib/Hash.c index 6ab23e1613..3d1e094794 100644 --- a/shared-bindings/hashlib/Hash.c +++ b/shared-bindings/hashlib/Hash.c @@ -92,6 +92,6 @@ STATIC MP_DEFINE_CONST_DICT(hashlib_hash_locals_dict, hashlib_hash_locals_dict_t MP_DEFINE_CONST_OBJ_TYPE( hashlib_hash_type, MP_QSTR_Hash, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &hashlib_hash_locals_dict ); diff --git a/shared-bindings/ipaddress/IPv4Address.c b/shared-bindings/ipaddress/IPv4Address.c index 13cc165c4d..95a683e94d 100644 --- a/shared-bindings/ipaddress/IPv4Address.c +++ b/shared-bindings/ipaddress/IPv4Address.c @@ -178,7 +178,7 @@ STATIC MP_DEFINE_CONST_DICT(ipaddress_ipv4address_locals_dict, ipaddress_ipv4add MP_DEFINE_CONST_OBJ_TYPE( ipaddress_ipv4address_type, MP_QSTR_Address, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, ipaddress_ipv4address_make_new, locals_dict, &ipaddress_ipv4address_locals_dict, print, ipaddress_ipv4address_print, diff --git a/shared-bindings/is31fl3741/FrameBuffer.c b/shared-bindings/is31fl3741/FrameBuffer.c index a7725ff65e..5804707228 100644 --- a/shared-bindings/is31fl3741/FrameBuffer.c +++ b/shared-bindings/is31fl3741/FrameBuffer.c @@ -295,7 +295,7 @@ STATIC mp_int_t is31fl3741_FrameBuffer_get_buffer(mp_obj_t self_in, mp_buffer_in MP_DEFINE_CONST_OBJ_TYPE( is31fl3741_FrameBuffer_type, MP_QSTR_is31fl3741, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &is31fl3741_FrameBuffer_locals_dict, make_new, is31fl3741_FrameBuffer_make_new, buffer, is31fl3741_FrameBuffer_get_buffer, diff --git a/shared-bindings/keypad/Event.c b/shared-bindings/keypad/Event.c index ea6dd0018b..57ce660978 100644 --- a/shared-bindings/keypad/Event.c +++ b/shared-bindings/keypad/Event.c @@ -183,7 +183,7 @@ STATIC MP_DEFINE_CONST_DICT(keypad_event_locals_dict, keypad_event_locals_dict_t MP_DEFINE_CONST_OBJ_TYPE( keypad_event_type, MP_QSTR_Event, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, keypad_event_make_new, print, keypad_event_print, locals_dict, &keypad_event_locals_dict, diff --git a/shared-bindings/keypad/EventQueue.c b/shared-bindings/keypad/EventQueue.c index 44450ec21c..1acb1ea500 100644 --- a/shared-bindings/keypad/EventQueue.c +++ b/shared-bindings/keypad/EventQueue.c @@ -168,7 +168,7 @@ STATIC const mp_stream_p_t eventqueue_p = { MP_DEFINE_CONST_OBJ_TYPE( keypad_eventqueue_type, MP_QSTR_EventQueue, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, unary_op, keypad_eventqueue_unary_op, #if MICROPY_PY_SELECT protocol, &eventqueue_p, diff --git a/shared-bindings/mdns/RemoteService.c b/shared-bindings/mdns/RemoteService.c index defd055722..6bf96a2a76 100644 --- a/shared-bindings/mdns/RemoteService.c +++ b/shared-bindings/mdns/RemoteService.c @@ -138,6 +138,6 @@ STATIC MP_DEFINE_CONST_DICT(mdns_remoteservice_locals_dict, mdns_remoteservice_l MP_DEFINE_CONST_OBJ_TYPE( mdns_remoteservice_type, MP_QSTR_RemoteService, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &mdns_remoteservice_locals_dict ); diff --git a/shared-bindings/mdns/Server.c b/shared-bindings/mdns/Server.c index d9afe891e6..a8d4325036 100644 --- a/shared-bindings/mdns/Server.c +++ b/shared-bindings/mdns/Server.c @@ -216,7 +216,7 @@ STATIC MP_DEFINE_CONST_DICT(mdns_server_locals_dict, mdns_server_locals_dict_tab MP_DEFINE_CONST_OBJ_TYPE( mdns_server_type, MP_QSTR_Server, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, mdns_server_make_new, locals_dict, &mdns_server_locals_dict ); diff --git a/shared-bindings/memorymonitor/AllocationSize.c b/shared-bindings/memorymonitor/AllocationSize.c index fe82a91553..449f8d825c 100644 --- a/shared-bindings/memorymonitor/AllocationSize.c +++ b/shared-bindings/memorymonitor/AllocationSize.c @@ -167,7 +167,7 @@ STATIC MP_DEFINE_CONST_DICT(memorymonitor_allocationsize_locals_dict, memorymoni MP_DEFINE_CONST_OBJ_TYPE( memorymonitor_allocationsize_type, MP_QSTR_AllocationSize, - MP_TYPE_FLAG_ITER_IS_GETITER, + MP_TYPE_FLAG_ITER_IS_GETITER | MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, memorymonitor_allocationsize_make_new, subscr, memorymonitor_allocationsize_subscr, unary_op, memorymonitor_allocationsize_unary_op, diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index 80064f75a0..56acca256b 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -173,6 +173,6 @@ STATIC MP_DEFINE_CONST_DICT(mcu_processor_locals_dict, mcu_processor_locals_dict MP_DEFINE_CONST_OBJ_TYPE( mcu_processor_type, MP_QSTR_Processor, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &mcu_processor_locals_dict ); diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index 36b342a594..ad8044490a 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -111,7 +111,7 @@ STATIC MP_DEFINE_CONST_DICT(mod_msgpack_exttype_locals_dict, mod_msgpack_exttype MP_DEFINE_CONST_OBJ_TYPE( mod_msgpack_exttype_type, MP_QSTR_ExtType, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, mod_msgpack_exttype_make_new, locals_dict, &mod_msgpack_exttype_locals_dict ); diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index f26edfea2c..cfb24d0dd4 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -292,7 +292,7 @@ STATIC MP_DEFINE_CONST_DICT(pulseio_pulsein_locals_dict, pulseio_pulsein_locals_ MP_DEFINE_CONST_OBJ_TYPE( pulseio_pulsein_type, MP_QSTR_PulseIn, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, pulseio_pulsein_make_new, locals_dict, &pulseio_pulsein_locals_dict, subscr, pulsein_subscr, diff --git a/shared-bindings/pwmio/PWMOut.c b/shared-bindings/pwmio/PWMOut.c index 5ec03d1c28..1408696c11 100644 --- a/shared-bindings/pwmio/PWMOut.c +++ b/shared-bindings/pwmio/PWMOut.c @@ -301,7 +301,7 @@ STATIC MP_DEFINE_CONST_DICT(pwmio_pwmout_locals_dict, pwmio_pwmout_locals_dict_t MP_DEFINE_CONST_OBJ_TYPE( pwmio_pwmout_type, MP_QSTR_PWMOut, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, pwmio_pwmout_make_new, locals_dict, &pwmio_pwmout_locals_dict ); diff --git a/shared-bindings/qrio/QRDecoder.c b/shared-bindings/qrio/QRDecoder.c index a2c8ea7ee8..aee23fd41e 100644 --- a/shared-bindings/qrio/QRDecoder.c +++ b/shared-bindings/qrio/QRDecoder.c @@ -142,7 +142,7 @@ STATIC MP_DEFINE_CONST_DICT(qrio_qrdecoder_locals, qrio_qrdecoder_locals_table); MP_DEFINE_CONST_OBJ_TYPE( qrio_qrdecoder_type_obj, MP_QSTR_QRDecoder, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, qrio_qrdecoder_make_new, locals_dict, &qrio_qrdecoder_locals ); diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 867d127207..fb645d3050 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -448,7 +448,7 @@ STATIC mp_int_t rgbmatrix_rgbmatrix_get_buffer(mp_obj_t self_in, mp_buffer_info_ MP_DEFINE_CONST_OBJ_TYPE( rgbmatrix_RGBMatrix_type, MP_QSTR_RGBMatrix, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &rgbmatrix_rgbmatrix_locals_dict, make_new, rgbmatrix_rgbmatrix_make_new, buffer, rgbmatrix_rgbmatrix_get_buffer, diff --git a/shared-bindings/rotaryio/IncrementalEncoder.c b/shared-bindings/rotaryio/IncrementalEncoder.c index 6a4e8098bc..51a43d97e9 100644 --- a/shared-bindings/rotaryio/IncrementalEncoder.c +++ b/shared-bindings/rotaryio/IncrementalEncoder.c @@ -183,7 +183,7 @@ STATIC MP_DEFINE_CONST_DICT(rotaryio_incrementalencoder_locals_dict, rotaryio_in MP_DEFINE_CONST_OBJ_TYPE( rotaryio_incrementalencoder_type, MP_QSTR_IncrementalEncoder, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, rotaryio_incrementalencoder_make_new, locals_dict, &rotaryio_incrementalencoder_locals_dict ); diff --git a/shared-bindings/rtc/RTC.c b/shared-bindings/rtc/RTC.c index 114055833d..6384f2ea70 100644 --- a/shared-bindings/rtc/RTC.c +++ b/shared-bindings/rtc/RTC.c @@ -128,7 +128,7 @@ STATIC MP_DEFINE_CONST_DICT(rtc_rtc_locals_dict, rtc_rtc_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( rtc_rtc_type, MP_QSTR_RTC, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, rtc_rtc_make_new, locals_dict, &rtc_rtc_locals_dict ); diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index 7c0d391957..d06d76825c 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -270,7 +270,7 @@ STATIC MP_DEFINE_CONST_DICT(sdioio_sdcard_locals_dict, sdioio_sdcard_locals_dict MP_DEFINE_CONST_OBJ_TYPE( sdioio_SDCard_type, MP_QSTR_SDCard, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, sdioio_sdcard_make_new, locals_dict, &sdioio_sdcard_locals_dict ); diff --git a/shared-bindings/ssl/SSLContext.c b/shared-bindings/ssl/SSLContext.c index 4b1c0c7403..0ed98d7a7c 100644 --- a/shared-bindings/ssl/SSLContext.c +++ b/shared-bindings/ssl/SSLContext.c @@ -201,7 +201,7 @@ STATIC MP_DEFINE_CONST_DICT(ssl_sslcontext_locals_dict, ssl_sslcontext_locals_di MP_DEFINE_CONST_OBJ_TYPE( ssl_sslcontext_type, MP_QSTR_SSLContext, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, ssl_sslcontext_make_new, locals_dict, &ssl_sslcontext_locals_dict ); diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index 672b59f076..8367f74420 100644 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -254,6 +254,6 @@ STATIC MP_DEFINE_CONST_DICT(supervisor_runtime_locals_dict, supervisor_runtime_l MP_DEFINE_CONST_OBJ_TYPE( supervisor_runtime_type, MP_QSTR_Runtime, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &supervisor_runtime_locals_dict ); diff --git a/shared-bindings/supervisor/StatusBar.c b/shared-bindings/supervisor/StatusBar.c index 4438c5fa4d..e77e4a9f71 100644 --- a/shared-bindings/supervisor/StatusBar.c +++ b/shared-bindings/supervisor/StatusBar.c @@ -121,6 +121,6 @@ STATIC MP_DEFINE_CONST_DICT(supervisor_status_bar_locals_dict, supervisor_status MP_DEFINE_CONST_OBJ_TYPE( supervisor_status_bar_type, MP_QSTR_Status_Bar, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &supervisor_status_bar_locals_dict ); diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c index 6d56da910a..6d0f24ab47 100644 --- a/shared-bindings/synthio/LFO.c +++ b/shared-bindings/synthio/LFO.c @@ -294,7 +294,7 @@ STATIC const synthio_block_proto_t lfo_proto = { MP_DEFINE_CONST_OBJ_TYPE( synthio_lfo_type, MP_QSTR_LFO, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, synthio_lfo_make_new, locals_dict, &synthio_lfo_locals_dict, print, lfo_print, diff --git a/shared-bindings/synthio/Math.c b/shared-bindings/synthio/Math.c index 44073e9a10..d111263728 100644 --- a/shared-bindings/synthio/Math.c +++ b/shared-bindings/synthio/Math.c @@ -294,7 +294,7 @@ STATIC const synthio_block_proto_t math_proto = { MP_DEFINE_CONST_OBJ_TYPE( synthio_math_type, MP_QSTR_Math, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, synthio_math_make_new, locals_dict, &synthio_math_locals_dict, print, math_print, diff --git a/shared-bindings/synthio/MidiTrack.c b/shared-bindings/synthio/MidiTrack.c index 253ae62b85..f9c5aa4b00 100644 --- a/shared-bindings/synthio/MidiTrack.c +++ b/shared-bindings/synthio/MidiTrack.c @@ -188,7 +188,7 @@ STATIC const audiosample_p_t synthio_miditrack_proto = { MP_DEFINE_CONST_OBJ_TYPE( synthio_miditrack_type, MP_QSTR_MidiTrack, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, synthio_miditrack_make_new, locals_dict, &synthio_miditrack_locals_dict, protocol, &synthio_miditrack_proto diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index a1aee54c54..acb12ae0db 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -320,7 +320,7 @@ STATIC MP_DEFINE_CONST_DICT(synthio_note_locals_dict, synthio_note_locals_dict_t MP_DEFINE_CONST_OBJ_TYPE( synthio_note_type, MP_QSTR_Note, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, synthio_note_make_new, locals_dict, &synthio_note_locals_dict, print, note_print diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index ef7eb1f1bc..59c5966c01 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -453,7 +453,7 @@ STATIC const audiosample_p_t synthio_synthesizer_proto = { MP_DEFINE_CONST_OBJ_TYPE( synthio_synthesizer_type, MP_QSTR_Synthesizer, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, synthio_synthesizer_make_new, locals_dict, &synthio_synthesizer_locals_dict, protocol, &synthio_synthesizer_proto diff --git a/shared-bindings/touchio/TouchIn.c b/shared-bindings/touchio/TouchIn.c index a5a2593630..982006b532 100644 --- a/shared-bindings/touchio/TouchIn.c +++ b/shared-bindings/touchio/TouchIn.c @@ -184,7 +184,7 @@ STATIC MP_DEFINE_CONST_DICT(touchio_touchin_locals_dict, touchio_touchin_locals_ MP_DEFINE_CONST_OBJ_TYPE( touchio_touchin_type, MP_QSTR_TouchIn, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, touchio_touchin_make_new, locals_dict, &touchio_touchin_locals_dict ); diff --git a/shared-bindings/usb/core/Device.c b/shared-bindings/usb/core/Device.c index 120bbefd45..4da92aa2f1 100644 --- a/shared-bindings/usb/core/Device.c +++ b/shared-bindings/usb/core/Device.c @@ -334,6 +334,6 @@ STATIC MP_DEFINE_CONST_DICT(usb_core_device_locals_dict, usb_core_device_locals_ MP_DEFINE_CONST_OBJ_TYPE( usb_core_device_type, MP_QSTR_Device, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &usb_core_device_locals_dict ); diff --git a/shared-bindings/usb_cdc/Serial.c b/shared-bindings/usb_cdc/Serial.c index 52bc3d7295..14c921dd3e 100644 --- a/shared-bindings/usb_cdc/Serial.c +++ b/shared-bindings/usb_cdc/Serial.c @@ -280,7 +280,7 @@ STATIC const mp_stream_p_t usb_cdc_serial_stream_p = { MP_DEFINE_CONST_OBJ_TYPE( usb_cdc_serial_type, MP_QSTR_Serial, - MP_TYPE_FLAG_ITER_IS_ITERNEXT, + MP_TYPE_FLAG_ITER_IS_ITERNEXT | MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &usb_cdc_serial_locals_dict, iter, mp_stream_unbuffered_iter, protocol, &usb_cdc_serial_stream_p diff --git a/shared-bindings/usb_hid/Device.c b/shared-bindings/usb_hid/Device.c index efd0d15a6e..ab0e600046 100644 --- a/shared-bindings/usb_hid/Device.c +++ b/shared-bindings/usb_hid/Device.c @@ -266,7 +266,7 @@ STATIC MP_DEFINE_CONST_DICT(usb_hid_device_locals_dict, usb_hid_device_locals_di MP_DEFINE_CONST_OBJ_TYPE( usb_hid_device_type, MP_QSTR_Device, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, usb_hid_device_make_new, locals_dict, &usb_hid_device_locals_dict ); diff --git a/shared-bindings/vectorio/Circle.c b/shared-bindings/vectorio/Circle.c index 4dc3058e74..4fa992d706 100644 --- a/shared-bindings/vectorio/Circle.c +++ b/shared-bindings/vectorio/Circle.c @@ -135,7 +135,7 @@ STATIC MP_DEFINE_CONST_DICT(vectorio_circle_locals_dict, vectorio_circle_locals_ MP_DEFINE_CONST_OBJ_TYPE( vectorio_circle_type, MP_QSTR_Circle, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, vectorio_circle_make_new, locals_dict, &vectorio_circle_locals_dict, protocol, &circle_draw_protocol diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index 251e113d9f..d9c923c0cd 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -144,7 +144,7 @@ STATIC MP_DEFINE_CONST_DICT(vectorio_polygon_locals_dict, vectorio_polygon_local MP_DEFINE_CONST_OBJ_TYPE( vectorio_polygon_type, MP_QSTR_Polygon, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, vectorio_polygon_make_new, locals_dict, &vectorio_polygon_locals_dict, protocol, &polygon_draw_protocol diff --git a/shared-bindings/vectorio/VectorShape.c b/shared-bindings/vectorio/VectorShape.c index c2bce53f09..95960c51f2 100644 --- a/shared-bindings/vectorio/VectorShape.c +++ b/shared-bindings/vectorio/VectorShape.c @@ -244,6 +244,6 @@ STATIC MP_DEFINE_CONST_DICT(vectorio_vector_shape_locals_dict, vectorio_vector_s MP_DEFINE_CONST_OBJ_TYPE( vectorio_vector_shape_type, MP_QSTR_VectorShape, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &vectorio_vector_shape_locals_dict ); diff --git a/shared-bindings/watchdog/WatchDogTimer.c b/shared-bindings/watchdog/WatchDogTimer.c index fca860fe92..ccbd3f6de1 100644 --- a/shared-bindings/watchdog/WatchDogTimer.c +++ b/shared-bindings/watchdog/WatchDogTimer.c @@ -151,6 +151,6 @@ STATIC MP_DEFINE_CONST_DICT(watchdog_watchdogtimer_locals_dict, watchdog_watchdo MP_DEFINE_CONST_OBJ_TYPE( watchdog_watchdogtimer_type, MP_QSTR_WatchDogTimer, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &watchdog_watchdogtimer_locals_dict ); diff --git a/shared-bindings/wifi/Monitor.c b/shared-bindings/wifi/Monitor.c index bde6caa59f..e2a6e3db4e 100644 --- a/shared-bindings/wifi/Monitor.c +++ b/shared-bindings/wifi/Monitor.c @@ -154,7 +154,7 @@ STATIC MP_DEFINE_CONST_DICT(wifi_monitor_locals_dict, wifi_monitor_locals_dict_t MP_DEFINE_CONST_OBJ_TYPE( wifi_monitor_type, MP_QSTR_Monitor, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, make_new, wifi_monitor_make_new, locals_dict, &wifi_monitor_locals_dict ); diff --git a/shared-bindings/wifi/Network.c b/shared-bindings/wifi/Network.c index d262b392eb..4bb860404b 100644 --- a/shared-bindings/wifi/Network.c +++ b/shared-bindings/wifi/Network.c @@ -122,6 +122,6 @@ STATIC MP_DEFINE_CONST_DICT(wifi_network_locals_dict, wifi_network_locals_dict_t MP_DEFINE_CONST_OBJ_TYPE( wifi_network_type, MP_QSTR_Network, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &wifi_network_locals_dict ); diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index dd56408561..065ee56a73 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -780,6 +780,6 @@ STATIC MP_DEFINE_CONST_DICT(wifi_radio_locals_dict, wifi_radio_locals_dict_table MP_DEFINE_CONST_OBJ_TYPE( wifi_radio_type, MP_QSTR_Radio, - MP_TYPE_FLAG_NONE, + MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS, locals_dict, &wifi_radio_locals_dict ); diff --git a/tests/unix/subclass_native.py b/tests/unix/subclass_native.py new file mode 100644 index 0000000000..fa80326db6 --- /dev/null +++ b/tests/unix/subclass_native.py @@ -0,0 +1,45 @@ +try: + NativeBaseClass +except NameError: + print("SKIP") + raise SystemExit + +# This tests two things that CircuitPython uses: +# 1. Native class's `make_new` get kwargs. +# 2. Native class's properties get used instead of creating a new attribute on +# the subclass instance. + +n = NativeBaseClass(test="direct kwarg") +print(".test:", n.test) + +n.test = "test set directly" +print(".test:", n.test) + + +class A(NativeBaseClass): + pass + + +a = A(test="subclass kwarg") +print(".test:", a.test) + +a.test = "test set indirectly" +print(".test:", a.test) + +a._new_attribute = True +print("._new_attribute", a._new_attribute) + + +class B(NativeBaseClass): + def __init__(self, suffix): + super().__init__(test="super init " + suffix) + + +b = B("suffix") +print(".test:", b.test) + +b.test = "test set indirectly through b" +print(".test:", b.test) + +b._new_attribute = True +print("._new_attribute", b._new_attribute) diff --git a/tests/unix/subclass_native.py.exp b/tests/unix/subclass_native.py.exp new file mode 100644 index 0000000000..a264d3b93a --- /dev/null +++ b/tests/unix/subclass_native.py.exp @@ -0,0 +1,11 @@ +.test: direct kwarg +native base class .test set to: 'test set directly' +.test: test set directly +.test: subclass kwarg +native base class .test set to: 'test set indirectly' +.test: test set indirectly +._new_attribute True +.test: super init suffix +native base class .test set to: 'test set indirectly through b' +.test: test set indirectly through b +._new_attribute True