This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nascheme
Recipients nascheme, pitrou, serhiy.storchaka, vstinner
Date 2017-12-13.21:54:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1513202084.24.0.213398074469.issue32312@psf.upfronthosting.co.za>
In-reply-to
Content
Private is fine.  We want to get the design correct before making it part of the official API.  My thought is that providing a handy atexit hook would be a good thing in that it could be an alternative to 3rd party code using __del__ to do cleanup.

One downside of atexit is that there is still a question of ordering the calls during shutdown.  I had the idea that maybe register() should take some sort of argument to specify when the function should be called.  That seems like leading down the road of madness maybe.  It would be useful to look at what other languages do, e.g. Java.  My understanding is that new versions of Java encourage finalizers like weakref callbacks and discourage or disallow finalizers like __del__.  I.e. you are not allowed to see the state of the object being finalized and cannot resurrect it.

Regarding m_traverse, maybe the list of finalizers should be stored somewhere in the interpreter state, not in the atexit module state.  That would make more sense to me.  atexit could merely be a way to manage it rather than actually holding it.
History
Date User Action Args
2017-12-13 21:54:44naschemesetrecipients: + nascheme, pitrou, vstinner, serhiy.storchaka
2017-12-13 21:54:44naschemesetmessageid: <1513202084.24.0.213398074469.issue32312@psf.upfronthosting.co.za>
2017-12-13 21:54:44naschemelinkissue32312 messages
2017-12-13 21:54:44naschemecreate