Broadly enable finalizers - #11439
Merged
Merged
Conversation
This enables finalizers for many more native CP objects. This allows implementations to use deinit for cleanup reliably. Older ports may do clean up using bulk resets that require never_reset for special cases. We're moving away from this so allow ports to opt-out of the bulk reset/never reset semantics. This also narrows the public pin API related to the guarding of reset_all_pins and reliable digitalinout deinit. First step to finishing micropython#8960
tannewt
marked this pull request as ready for review
September 22, 2026 18:59
dhalbert
reviewed
Sep 22, 2026
dhalbert
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, and plenty here for now.
Did you do some smoke tests on this, like allocating an I2C and then doing ctrl-D and making sure you can do it again?
Member
Author
I did not do a smoke test. I only made sure the builds work. I believe this is now equivalent of calling |
Collaborator
|
I tested an RP2040 Feather, creating a UART, then ctrl-D and creating it on the same pins again. It worked as expected. |
dhalbert
approved these changes
Sep 23, 2026
tyeth
pushed a commit
to tyeth/circuitpython
that referenced
this pull request
Oct 3, 2026
Document this in cpydiff and add a test with expected output for coverage testing. As discussed in adafruit#11441, the code growth from handling this case seems to outweigh the benefit of implementing it properly. Closes: adafruit#11439 Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This enables finalizers for many more native CP objects. This allows implementations to use deinit for cleanup reliably.
Older ports may do clean up using bulk resets that require never_reset for special cases. We're moving away from this so allow ports to opt-out of the bulk reset/never reset semantics.
This also narrows the public pin API related to the guarding of reset_all_pins and reliable digitalinout deinit.
First step to finishing #8960