forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
bugregressionThings that used to work but don't any longerThings that used to work but don't any longer
Milestone
Description
Since #10040 (9.2.5 and after) this happens with the i2ctarget example:
code starting...
9.789: INFO - read request to address '0x40'
Traceback (most recent call last):
File "code.py", line 38, in <module>
AttributeError: 'I2CTargetRequest' object has no attribute 'deinit'This is apparently because the new default __exit__ requires the presence of deinit in the object's dictionary, and I2CTargetRequest doesn't have one. It has a close() though, (which incidentally doesn't have a docstring).
Should I2CTargetRequest have a deinit() that calls common_hal_i2ctarget_i2c_target_close() and also maybe remove the close() method ?
| mp_load_method(args[0], MP_QSTR_deinit, dest); |
circuitpython/shared-bindings/i2ctarget/I2CTarget.c
Lines 395 to 405 in d88fe10
| static const mp_rom_map_elem_t i2ctarget_i2c_target_request_locals_dict_table[] = { | |
| { 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_address), MP_ROM_PTR(&i2ctarget_i2c_target_request_address_obj) }, | |
| { MP_ROM_QSTR(MP_QSTR_is_read), MP_ROM_PTR(&i2ctarget_i2c_target_request_is_read_obj) }, | |
| { MP_ROM_QSTR(MP_QSTR_is_restart), MP_ROM_PTR(&i2ctarget_i2c_target_request_is_restart_obj) }, | |
| { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&i2ctarget_i2c_target_request_read_obj) }, | |
| { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&i2ctarget_i2c_target_request_write_obj) }, | |
| { MP_ROM_QSTR(MP_QSTR_ack), MP_ROM_PTR(&i2ctarget_i2c_target_request_ack_obj) }, | |
| { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&i2ctarget_i2c_target_request_close_obj) }, | |
| }; |
Metadata
Metadata
Assignees
Labels
bugregressionThings that used to work but don't any longerThings that used to work but don't any longer