Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add, use a default __exit__ object #10040

Merged
merged 5 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions ports/espressif/bindings/espcamera/Camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "shared-bindings/displayio/Bitmap.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/util.h"
#include "shared/runtime/context_manager_helpers.h"
#include "esp_camera.h"
#include "sensor.h"

Expand Down Expand Up @@ -169,11 +170,7 @@ static void check_for_deinit(espcamera_camera_obj_t *self) {
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t espcamera_camera_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
return espcamera_camera_deinit(args[0]);
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espcamera_camera___exit___obj, 4, 4, espcamera_camera_obj___exit__);
// Provided by context manager helper.

//| frame_available: bool
//| """True if a frame is available, False otherwise"""
Expand Down Expand Up @@ -947,8 +944,8 @@ static const mp_rom_map_elem_t espcamera_camera_locals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_denoise), MP_ROM_PTR(&espcamera_camera_denoise_obj) },
{ MP_ROM_QSTR(MP_QSTR_framebuffer_count), MP_ROM_PTR(&espcamera_camera_framebuffer_count_obj) },
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&espcamera_camera_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espcamera_camera___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR_exposure_ctrl), MP_ROM_PTR(&espcamera_camera_exposure_ctrl_obj) },
{ MP_ROM_QSTR(MP_QSTR_frame_available), MP_ROM_PTR(&espcamera_camera_frame_available_obj) },
{ MP_ROM_QSTR(MP_QSTR_frame_size), MP_ROM_PTR(&espcamera_camera_frame_size_obj) },
Expand Down
11 changes: 4 additions & 7 deletions ports/espressif/bindings/espnow/ESPNow.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "py/stream.h"

#include "shared-bindings/util.h"
#include "shared/runtime/context_manager_helpers.h"

#include "bindings/espnow/ESPNow.h"
#include "bindings/espnow/Peer.h"
Expand Down Expand Up @@ -92,11 +93,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(espnow_deinit_obj, espnow_deinit);
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t espnow_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
return espnow_deinit(args[0]);
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow___exit___obj, 4, 4, espnow_obj___exit__);
// Provided by context manager helper.

// --- Send and Read messages ---

Expand Down Expand Up @@ -270,8 +267,8 @@ MP_PROPERTY_GETTER(espnow_peers_obj,

static const mp_rom_map_elem_t espnow_locals_dict_table[] = {
// Context managers
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espnow___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },

// Deinit the object
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&espnow_deinit_obj) },
Expand Down
11 changes: 4 additions & 7 deletions ports/espressif/bindings/espulp/ULP.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/util.h"
#include "shared/runtime/context_manager_helpers.h"
#include "bindings/espulp/ULP.h"

#include "py/enum.h"
Expand Down Expand Up @@ -69,11 +70,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(espulp_ulp_deinit_obj, espulp_ulp_deinit);
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t espulp_ulp_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
return espulp_ulp_deinit(args[0]);
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espulp_ulp___exit___obj, 4, 4, espulp_ulp_obj___exit__);
// Provided by context manager helper.

//| def set_wakeup_period(self, period_index: int, period_us: int) -> None:
//| """Sets the wakeup period for the ULP.
Expand Down Expand Up @@ -188,8 +185,8 @@ MP_PROPERTY_GETTER(espulp_ulp_arch_obj,

static const mp_rom_map_elem_t espulp_ulp_locals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&espulp_ulp_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espulp_ulp___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR_set_wakeup_period), MP_ROM_PTR(&espulp_ulp_set_wakeup_period_obj) },
{ MP_ROM_QSTR(MP_QSTR_run), MP_ROM_PTR(&espulp_ulp_run_obj) },
{ MP_ROM_QSTR(MP_QSTR_halt), MP_ROM_PTR(&espulp_ulp_halt_obj) },
Expand Down
8 changes: 1 addition & 7 deletions ports/raspberrypi/bindings/rp2pio/StateMachine.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_deinit_obj, rp2pio_statemachine_ob
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t rp2pio_statemachine_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_rp2pio_statemachine_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2pio_statemachine_obj___exit___obj, 4, 4, rp2pio_statemachine_obj___exit__);


static void check_for_deinit(rp2pio_statemachine_obj_t *self) {
Expand Down Expand Up @@ -1126,7 +1120,7 @@ MP_PROPERTY_GETTER(rp2pio_statemachine_last_write_obj,
static const mp_rom_map_elem_t rp2pio_statemachine_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&rp2pio_statemachine_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&rp2pio_statemachine_obj___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },

{ MP_ROM_QSTR(MP_QSTR_stop), MP_ROM_PTR(&rp2pio_statemachine_stop_obj) },
{ MP_ROM_QSTR(MP_QSTR_restart), MP_ROM_PTR(&rp2pio_statemachine_restart_obj) },
Expand Down
9 changes: 2 additions & 7 deletions ports/zephyr-cp/bindings/zephyr_serial/UART.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,7 @@ static void check_for_deinit(zephyr_serial_uart_obj_t *self) {
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t _zephyr_serial_uart_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
zephyr_serial_uart_deinit(MP_OBJ_TO_PTR(args[0]));
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(_zephyr_serial_uart___exit___obj, 4, 4, _zephyr_serial_uart_obj___exit__);
// Provided by context manager helper.

// These are standard stream methods. Code is in py/stream.c.
//
Expand Down Expand Up @@ -259,7 +254,7 @@ static const mp_rom_map_elem_t _zephyr_serial_uart_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&_zephyr_serial_uart_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&_zephyr_serial_uart_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&_zephyr_serial_uart___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },
jepler marked this conversation as resolved.
Show resolved Hide resolved

// Standard stream methods.
{ MP_OBJ_NEW_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
Expand Down
9 changes: 2 additions & 7 deletions shared-bindings/analogbufio/BufferedIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ static void check_for_deinit(analogbufio_bufferedin_obj_t *self) {
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t analogbufio_bufferedin___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_analogbufio_bufferedin_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogbufio_bufferedin___exit___obj, 4, 4, analogbufio_bufferedin___exit__);
// Provided by context manager helper.

//| def readinto(self, buffer: WriteableBuffer, loop: bool = False) -> int:
//| """Fills the provided buffer with ADC voltage values.
Expand Down Expand Up @@ -144,7 +139,7 @@ static const mp_rom_map_elem_t analogbufio_bufferedin_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&analogbufio_bufferedin_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&analogbufio_bufferedin_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&analogbufio_bufferedin___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&analogbufio_bufferedin_readinto_obj)},
};

Expand Down
9 changes: 2 additions & 7 deletions shared-bindings/analogio/AnalogIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,7 @@ static void check_for_deinit(analogio_analogin_obj_t *self) {
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t analogio_analogin___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_analogio_analogin_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogin___exit___obj, 4, 4, analogio_analogin___exit__);
// Provided by context manager helper.

//| value: int
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only)
Expand Down Expand Up @@ -135,7 +130,7 @@ MP_PROPERTY_GETTER(analogio_analogin_reference_voltage_obj,
static const mp_rom_map_elem_t analogio_analogin_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&analogio_analogin_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&analogio_analogin___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&analogio_analogin_value_obj)},
{ MP_ROM_QSTR(MP_QSTR_reference_voltage), MP_ROM_PTR(&analogio_analogin_reference_voltage_obj)},
};
Expand Down
11 changes: 3 additions & 8 deletions shared-bindings/analogio/AnalogOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(analogio_analogout_deinit_obj, analogio_analogo
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_analogio_analogout_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4, analogio_analogout___exit__);
// Provided by context manager helper.

//| value: int
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only)
Expand All @@ -105,9 +100,9 @@ MP_PROPERTY_GETSET(analogio_analogout_value_obj,

static const mp_rom_map_elem_t analogio_analogout_locals_dict_table[] = {
// instance methods
{ MP_OBJ_NEW_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&analogio_analogout_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&analogio_analogout_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&analogio_analogout___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },

// Properties
{ MP_OBJ_NEW_QSTR(MP_QSTR_value), (mp_obj_t)&analogio_analogout_value_obj },
Expand Down
9 changes: 2 additions & 7 deletions shared-bindings/audiobusio/I2SOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,7 @@ static void check_for_deinit(audiobusio_i2sout_obj_t *self) {
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_audiobusio_i2sout_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, audiobusio_i2sout_obj___exit__);
// Provided by context manager helper.


//| def play(self, sample: circuitpython_typing.AudioSample, *, loop: bool = False) -> None:
Expand Down Expand Up @@ -248,7 +243,7 @@ static const mp_rom_map_elem_t audiobusio_i2sout_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&audiobusio_i2sout_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audiobusio_i2sout_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audiobusio_i2sout___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR_play), MP_ROM_PTR(&audiobusio_i2sout_play_obj) },
{ MP_ROM_QSTR(MP_QSTR_stop), MP_ROM_PTR(&audiobusio_i2sout_stop_obj) },
{ MP_ROM_QSTR(MP_QSTR_pause), MP_ROM_PTR(&audiobusio_i2sout_pause_obj) },
Expand Down
9 changes: 2 additions & 7 deletions shared-bindings/audiobusio/PDMIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,7 @@ static void check_for_deinit(audiobusio_pdmin_obj_t *self) {
//| """Automatically deinitializes the hardware when exiting a context."""
//| ...
//|
static mp_obj_t audiobusio_pdmin_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_audiobusio_pdmin_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_pdmin___exit___obj, 4, 4, audiobusio_pdmin_obj___exit__);
// Provided by context manager helper.


//| def record(self, destination: WriteableBuffer, destination_length: int) -> None:
Expand Down Expand Up @@ -220,7 +215,7 @@ static const mp_rom_map_elem_t audiobusio_pdmin_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&audiobusio_pdmin_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audiobusio_pdmin_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audiobusio_pdmin___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR_record), MP_ROM_PTR(&audiobusio_pdmin_record_obj) },
{ MP_ROM_QSTR(MP_QSTR_sample_rate), MP_ROM_PTR(&audiobusio_pdmin_sample_rate_obj) }
};
Expand Down
9 changes: 2 additions & 7 deletions shared-bindings/audiocore/RawSample.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(audioio_rawsample_deinit_obj, audioio_rawsample
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t audioio_rawsample_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_audioio_rawsample_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_rawsample___exit___obj, 4, 4, audioio_rawsample_obj___exit__);
// Provided by context manager helper.

//| sample_rate: Optional[int]
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second).
Expand All @@ -151,7 +146,7 @@ static const mp_rom_map_elem_t audioio_rawsample_locals_dict_table[] = {
// Methods
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audioio_rawsample_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audioio_rawsample___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },

// Properties
AUDIOSAMPLE_FIELDS,
Expand Down
9 changes: 2 additions & 7 deletions shared-bindings/audiocore/WaveFile.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(audioio_wavefile_deinit_obj, audioio_wavefile_d
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_audioio_wavefile_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__);
// Provided by context manager helper.

//| sample_rate: int
//| """32 bit value that dictates how quickly samples are loaded into the DAC
Expand All @@ -124,7 +119,7 @@ static const mp_rom_map_elem_t audioio_wavefile_locals_dict_table[] = {
// Methods
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audioio_wavefile_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audioio_wavefile___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },

// Properties
AUDIOSAMPLE_FIELDS,
Expand Down
9 changes: 2 additions & 7 deletions shared-bindings/audiodelays/Echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,7 @@ static void check_for_deinit(audiodelays_echo_obj_t *self) {
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t audiodelays_echo_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_audiodelays_echo_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiodelays_echo___exit___obj, 4, 4, audiodelays_echo_obj___exit__);
// Provided by context manager helper.


//| delay_ms: synthio.BlockInput
Expand Down Expand Up @@ -281,7 +276,7 @@ static const mp_rom_map_elem_t audiodelays_echo_locals_dict_table[] = {
// Methods
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audiodelays_echo_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audiodelays_echo___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR_play), MP_ROM_PTR(&audiodelays_echo_play_obj) },
{ MP_ROM_QSTR(MP_QSTR_stop), MP_ROM_PTR(&audiodelays_echo_stop_obj) },

Expand Down
9 changes: 2 additions & 7 deletions shared-bindings/audiofilters/Distortion.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,7 @@ static void check_for_deinit(audiofilters_distortion_obj_t *self) {
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t audiofilters_distortion_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_audiofilters_distortion_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiofilters_distortion___exit___obj, 4, 4, audiofilters_distortion_obj___exit__);
// Provided by context manager helper.


//| drive: synthio.BlockInput
Expand Down Expand Up @@ -357,7 +352,7 @@ static const mp_rom_map_elem_t audiofilters_distortion_locals_dict_table[] = {
// Methods
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audiofilters_distortion_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audiofilters_distortion___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR_play), MP_ROM_PTR(&audiofilters_distortion_play_obj) },
{ MP_ROM_QSTR(MP_QSTR_stop), MP_ROM_PTR(&audiofilters_distortion_stop_obj) },

Expand Down
9 changes: 2 additions & 7 deletions shared-bindings/audiofilters/Filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,7 @@ static void check_for_deinit(audiofilters_filter_obj_t *self) {
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t audiofilters_filter_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_audiofilters_filter_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiofilters_filter___exit___obj, 4, 4, audiofilters_filter_obj___exit__);
// Provided by context manager helper.


//| filter: synthio.Biquad | Tuple[synthio.Biquad] | None
Expand Down Expand Up @@ -229,7 +224,7 @@ static const mp_rom_map_elem_t audiofilters_filter_locals_dict_table[] = {
// Methods
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audiofilters_filter_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audiofilters_filter___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&default___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR_play), MP_ROM_PTR(&audiofilters_filter_play_obj) },
{ MP_ROM_QSTR(MP_QSTR_stop), MP_ROM_PTR(&audiofilters_filter_stop_obj) },

Expand Down
Loading
Loading