Author paul.moore
Recipients paul.moore, pje
Date 2008-03-20.23:55:31
SpamBayes Score 0.137436
Marked as misclassified No
Message-id <1206057333.58.0.377743936853.issue2439@psf.upfronthosting.co.za>
In-reply-to
Content
Is that true? loader.load_module(pkg) should return sys.modules[pkg]
without reloading if it already exists. See PEP 302 "Specification part
1: The Importer Protocol":

The load_module() method has a few responsibilities that it must
fulfil *before* it runs any code:

 - If there is an existing module object named 'fullname' in
   sys.modules, the loader must use that existing module.
   (Otherwise, the reload() builtin will not work correctly.)
   If a module named 'fullname' does not exist in sys.modules,
   the loader must create a new module object and add it to
   sys.modules.

I've added a test for this, but I'm not 100% sure it's right. It
certainly works with unchanged code. If you can make it fail, let me
know and I'll work up a fix. But I think repeated calls to load_module()
should be safe (assuming loaders work as required by PEP 302).
History
Date User Action Args
2008-03-20 23:55:33paul.mooresetspambayes_score: 0.137436 -> 0.137436
recipients: + paul.moore, pje
2008-03-20 23:55:33paul.mooresetspambayes_score: 0.137436 -> 0.137436
messageid: <1206057333.58.0.377743936853.issue2439@psf.upfronthosting.co.za>
2008-03-20 23:55:32paul.moorelinkissue2439 messages
2008-03-20 23:55:32paul.moorecreate