Skip to content
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

WIP: run finalizers before shutdown #18189

Open
wants to merge 2 commits into
base: master
from

Conversation

@nascheme
Copy link
Member

nascheme commented Jan 25, 2020

Before the interpreter shuts down, run finalizers (weakref callbacks and __del__ methods) using the GC machinery. This could be a cleaner way to shutdown since it is less likely finalizer code will be running while the interpreter is in an invalid state (i.e. part-way shutting down).

This is just a quick proof-of-concept. It seems to run but quite a few unit tests fail.

- Disable audit hook (crashes)
- Run finalizers a bit later (so sys.is_finalizing() is set)
- Don't clear call tp_clear
- Don't move legacy finalizers to gc.garbage list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.