[Python-Dev] Problem between deallocation of modules and func_globals

"Martin v. Löwis" martin at v.loewis.de
Sat Jan 20 00:55:07 CET 2007


Josiah Carlson schrieb:
> I was saying that it would be nice if the following were true:
> 
>     >>> encodings.__module__
>     <module 'encodings' from 'C:\python25\lib\encodings\__init__.pyc'>

Ah, ok. It would be somewhat confusing, though, that __module__ is
sometimes a module object, and sometimes a string (it certainly confused
me).

> So what if it is a circular reference (module references dict which
> references module), we've got a GC which handles cycles just fine (when
> users try not to be too smart).

That remains to be seen in practice. Currently, modules are explicitly
cleared at shutdown. I think any cycle with an object implementing
__del__ will keep loads of modules alive, noncollectable for GC.

Regards,
Martin


More information about the Python-Dev mailing list