-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat!
Some have
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) },
and some are
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
Are these the same thing? Should there be just one choice?
That's a good question! I used a #define so that (I suspect but don't know for sure that It's super sus that this didn't build any boards! ci_set_matrix found the changed files but decided not to build any boards. from the build log:
|
Recently in adafruit#10026 this script was altered so that sometimes items are removed from `boards`. However, this could have side effects. For instance, when a file like `shared/runtime/context_manager_helpers.c` is modified, it doesn't match any per-port or per-board rule so we execute `boards_to_build = all_board_ids`. But if the object `all_board_ids` refers to has been modified by `boards.remove(board)` in an earlier iteration, then we don't end up really building all boards. Noticed during development of adafruit#10040.
5a79e13
to
392e777
Compare
This just delegates to .deinit(). Also, change default __enter__ to a macro that reuses the identically-beving "identity_obj", and harmonize a few sites so that the naming s consistent. Saves about 800 bytes on metro rp2350.
392e777
to
8aa1969
Compare
There are more exeptions scattered across the codebase, but this is the only one that foiled my attempts to use grep to check that every object using default___exit___obj also had a deinit method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup, one place I noticed.
@@ -259,7 +259,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) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The zephyr_serial_uart___exit___
code was not deleted in this file. Did you mean to do that?
This just delegates to .
deinit()
.Also, reuse
identity_obj
for default__enter__
.Saves about 800 bytes on metro rp2350.