[Python-Dev] SVN rev. 85392 broke module handling in py3k
Antoine Pitrou
solipsis at pitrou.net
Fri Oct 22 18:17:55 CEST 2010
On Fri, 22 Oct 2010 17:37:53 +0200
Stefan Behnel <stefan_ml at behnel.de> wrote:
>
> I think the general problem is that "the module" can be a pretty broad
> thing, potentially referring to all sorts of stuff such as (usually)
> several other modules.
I wouldn't think of unloading modules as a general problem. We should
support it for various reasons (including your use case), but if it
takes a further garbage collection pass to get rid of all stale
objects, then so be it.
> It would also mean that each and every function will end up in a reference
> cycle by default that will require garbage collection for cleanup.
This is already the case, since most functions are in a reference cycle
with their own globals dict (== module dict). It's just that the
reference cycle would then include the module object as well, but I
don't see it as a big drawback. The module object holds little to no
state except its dict, precisely.
Regards
Antoine.
More information about the Python-Dev
mailing list