8000 shared-bindings/i2ctarget/I2CTarget.c: add finaliser · sparkfun/circuitpython@62e84c4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 62e84c4

Browse files
committed
shared-bindings/i2ctarget/I2CTarget.c: add finaliser
1 parent 97ed02d commit 62e84c4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

shared-bindings/i2ctarget/I2CTarget.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static mp_obj_t mp_obj_new_i2ctarget_i2c_target_request(i2ctarget_i2c_target_obj
4949
//| :param bool smbus: Use SMBUS timings if the hardware supports it"""
5050
//| ...
5151
static mp_obj_t i2ctarget_i2c_target_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
52-
i2ctarget_i2c_target_obj_t *self = mp_obj_malloc(i2ctarget_i2c_target_obj_t, &i2ctarget_i2c_target_type);
52+
i2ctarget_i2c_target_obj_t *self = mp_obj_malloc_with_finaliser(i2ctarget_i2c_target_obj_t, &i2ctarget_i2c_target_type);
5353
enum { ARG_scl, ARG_sda, ARG_addresses, ARG_smbus };
5454
static const mp_arg_t allowed_args[] = {
5555
{ MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ },
@@ -186,6 +186,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(i2ctarget_i2c_target_request_obj, 1, i2ctarget
186186

187187
static const mp_rom_map_elem_t i2ctarget_i2c_target_locals_dict_table[] = {
188188
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&i2ctarget_i2c_target_deinit_obj) },
189+
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&i2ctarget_i2c_target_deinit_obj) },
189190
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
190191
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&i2ctarget_i2c_target___exit___obj) },
191192
{ MP_ROM_QSTR(MP_QSTR_request), MP_ROM_PTR(&i2ctarget_i2c_target_request_obj) },

0 commit comments

Comments
 (0)
0