-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
del should call __del__ method #1802
Comments
This is not strictly a bug. CPython docs say " Workaround would be to call gc.collect() after doing the del. Then it should collect the object and call the finaliser. Additional workaround for socket would be to call s.close() instead of doing del s. Did you hit a problem with this in real code? |
The 'real python' way would imo be context managers, i.e.
|
My understanding is that good coding practice is to assume that |
Closed in favour of #1878. |
Revert "nrf nvm: touchups to nickzoic PR micropython#1768"
Example test with custom object:
Also for builtin types with finaliser, like socket.socket.
Example case:
The text was updated successfully, but these errors were encountered: