[Import-SIG] PEP 451 (ModuleSpec) round 3

Nick Coghlan ncoghlan at gmail.com
Thu Aug 29 00:10:38 CEST 2013


Proper review on the weekend, but quickish comments for now:

- update looks really good, and solves several issues with the original
proposal. Big +1 for keeping it simple and adding a new finder method :)

- for extension modules that don't define a creation hook (which I won't be
able to figure out before create_module is called), I'd like to be able to
return NotImplemented from create_module to say "please give me a normal
module, or re-use the existing one for reloading".

- I'd like to finally make "can reload or not" explicit in the loader API.
My current idea for this is to add a "reloading" parameter to
create_module, where we pass in the module to be reloaded. Loaders that
support reloading *must* either not define create_module, or, if they
define it, return NotImplemented or return the passed in module in that
case. If it returns a new module, the reload should fail. This shouldn't
break backwards compatibility, as init based extension modules are cached
internally, while modules that use the new hooks can decide for themselves
whether or not to support reloading

- I need to check the other proposed reload changes for backwards
compatibility issues (I'm not sure we can ignore changes made to
sys.modules in that case)

- frozen modules should have a special origin string, too

- my preferred bikeshed colours are "loader_state" or "loader_info"

Cheers,
Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/import-sig/attachments/20130829/353eb951/attachment.html>


More information about the Import-SIG mailing list