
On Sep 29, 2010, at 11:11 PM, Steven D'Aprano wrote:
On Wed, 29 Sep 2010 10:42:27 pm Antoine Pitrou wrote:
My assumption is/was that the benefit of warning against leaks in real applications (or even - sigh - the standard library) would outweigh the inconvenience when hacking together a quick script.
But if it doesn't, what about enabling it with a command-line switch?
I think the ability to detect such file descriptor leaks would be valuable, but I'm not sure that it should be running all the time. At the risk of bike-shedding, is it something which could be controlled at runtime, like garbage collection? E.g. something like:
gc.enable_file_warnings() run_my_tests_for_leakage() gc.disable_file_warnings()
or similar. (I'm not wedded to it being in the gc module.)
I don't think it should be in the gc module, but I would prefer it be enabled and controlled through a separate module, rather than something Python does automatically for your convenience. -Barry