unloading a module created with imp.new_module
ian.g.kelly at gmail.com
Mon Nov 24 02:27:14 CET 2014
On Nov 23, 2014 4:10 AM, "Patrick Stinson" <patrickkidd at gmail.com> wrote:
> m = types.ModuleType('mine')
> exec(s, m.__dict__)
> m = None
> and the output is:
> I the “__del__" to come between “deleting…” and “done”. This is not being
run from the interactive interpreter by via a .py file.
This suggests the presence of a reference cycle, since the object is
deleted afterward by the garbage collector. One cycle here is that the
__del__ function has a reference to the module's globals dict, which has a
reference to the class instance, which has a reference to the class, which
has a reference back to the function. There may be other cycles here as
well, but it may also be that the module object itself isn't part of them.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list