
On 3/19/08, Vinay Sajip <vinay_sajip@red-dove.com> wrote:
I think (repeatedly) testing an app through IDLE is a reasonable use case.
[other threads may still have references to loggers or handlers]
Would it be reasonable for shutdown to remove logging from sys.modules, so that a rerun has some chance of succeeding via its own import?
I'm not sure that would be enough in the scenario I mentioned above - would removing a module from sys.modules be a guarantee of removing it from memory?
No. It will explicitly not be removed from memory while anything holds a live reference. Removing it from sys.modules just means that the next time a module does "import logging", the logging initialization code will run again. It is true that this could cause contention if the old version is still holding an exclusive lock on some output file.
It's safer, in my view, for the developer of an application to do cleanup of their app if they want to test repeatedly in IDLE.
Depending on the issue just fixed, the app may not have a clean shutdown. -jJ