Re: PEP 451 (ModuleSpec) round 3
Nick Coghlan <[email protected]>
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <CADiSq7daqr5=XgZdKiOtQXWcqAp3LUOWOq5x41HA=xr9bLC28g@mail.gmail.com> |
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. _______________________________________________ Import-SIG mailing list [email protected] http://mail.python.org/mailman/listinfo/import-sig