[Python-Dev] Problem between deallocation of modules and func_globals (original) (raw)
Josiah Carlson jcarlson at uci.edu
Fri Jan 19 21:09:48 CET 2007
- Previous message: [Python-Dev] Problem between deallocation of modules and func_globals
- Next message: [Python-Dev] Problem between deallocation of modules and func_globals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Martin v. Löwis" <martin at v.loewis.de> wrote:
Josiah Carlson schrieb: > Seems to me like a bug, but the bug could be fixed if the module's > dictionary kept a (circular) reference to the module object. Who else > has been waiting for a module attribute? This is the time machine at work: py> import encodings py> encodings.searchfunction.module 'encodings' It's a string, rather than the module object, precisely to avoid cyclic references.
I was saying that it would be nice if the following were true:
>>> encodings.__module__
<module 'encodings' from 'C:\python25\lib\encodings\__init__.pyc'>
That would make it easier for functions inside a module to pass around references to the module namespace (I've had the need to do so before, and have ended up using sys.modules[name], but that doesn't always work).
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).
- Josiah
- Previous message: [Python-Dev] Problem between deallocation of modules and func_globals
- Next message: [Python-Dev] Problem between deallocation of modules and func_globals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]