variables bound in moudules are None when module is not completely imported

chrysn at fsfe.org chrysn at fsfe.org
Thu Feb 26 00:24:33 CET 2009


On Wed, Feb 25, 2009 at 05:05:28PM -0200, Gabriel Genellina wrote:
> I'd try to move all the global stuff in that module into a function,  
> "init". Importing the module will always succeed - you have to manually  
> call init() after importing it.

i normally do that anyway and would also have done so here (afaik, it's
best practice anyway), but this is in this case not possible as the
modules in question are not under my control at all. as pep 299 has been
turned down, this can't really be considered a bug of those files.

anyway, it would just be another workaround around the globals
disappearing.

> That makes a strange situation where the module doesn't exist in  
> sys.modules but its globals are still alive...

is this a known bug? i mean from a garbage collection / refcount point
of view, at least everything that is still referenced somewhere should
be preserved.

thanks
chrysn

-- 
To use raw power is to make yourself infinitely vulnerable to greater powers.
  -- Bene Gesserit axiom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20090226/45955411/attachment.sig>


More information about the Python-list mailing list