[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2019-06-28 Thread Brett Cannon
Brett Cannon added the comment: Do realize the person who created and closed this issue is the one suggesting you open a new issue. ;) We can re-evaluate decisions and this one is 5 years old. Now I'm not making any promises that we will definitely change anything, but I'm not going to swoop

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2019-06-27 Thread Anthony Sottile
Anthony Sottile added the comment: I suspect it would be closed since it's essentially just a revert of this issue :S -- ___ Python tracker ___ __

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2019-06-27 Thread Brett Cannon
Brett Cannon added the comment: Feel free to open a new issue to propose changing it. -- ___ Python tracker ___ ___ Python-bugs-lis

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2019-06-26 Thread Anthony Sottile
Anthony Sottile added the comment: yeah I guess I'm just curious why this bug (seemingly intentionally) made the implementation diverge from PEP 451 and require an empty `create_module` (and where I would have found that except by searching bugs.python.org) Everyone I've shown this bit of co

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2019-06-26 Thread Brett Cannon
Brett Cannon added the comment: > Mostly looking for something that says how `create_module` should / shouldn't > be implemented Basically you only need to provide the method if you want to use a custom object for the module itself. So as long as the object can quack like a module object yo

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2019-06-26 Thread Anthony Sottile
Anthony Sottile added the comment: Mostly looking for something that says how `create_module` should / shouldn't be implemented (and why `return None` is necessary) -- ___ Python tracker ___

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2019-06-26 Thread Brett Cannon
Brett Cannon added the comment: The import machinery docs are split between the language reference and importlib itself. It really depends on what you're looking for. -- ___ Python tracker _

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2019-06-26 Thread Anthony Sottile
Anthony Sottile added the comment: Where can I find up to date best practices / docs for the import machinery? I couldn't find a mention of this in docs.python.org -- ___ Python tracker

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2019-06-26 Thread Brett Cannon
Brett Cannon added the comment: PEPs are not living documents unless they are marked as Active (which PEP 451 is not). -- ___ Python tracker ___ _

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2019-06-25 Thread Anthony Sottile
Anthony Sottile added the comment: Hi! just stumbled on this as I was updating pytest's import hook. I notice in PEP 451 this is still marked as optional (then again, I don't know whether PEPs are supposed to be living standards or not, or if there was a PEP which supersedes that one with b

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2015-01-09 Thread Brett Cannon
Changes by Brett Cannon : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ P

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2015-01-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset ab72f30bcd9f by Brett Cannon in branch 'default': Issue #23014: Make importlib.abc.Loader.create_module() required when https://hg.python.org/cpython/rev/ab72f30bcd9f -- nosy: +python-dev ___ Python track

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-16 Thread Eric Snow
Eric Snow added the comment: @Brett Discussing this at PyCon sounds good. I'm in favor of dropping load_module as soon as possible (if possible), as you might have guessed by the way I implemented the module spec code. :) I agree that we should make a decision about load_module one way or t

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-16 Thread Eric Snow
Eric Snow added the comment: @Nick As long as those esoteric cases can be handled without much work via create_module and exec_module, we should have a goal in mind for yanking legacy load_module support. If there are valid use cases that can't be handled via PEP 451 then I'd say we should c

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-16 Thread Brett Cannon
Brett Cannon added the comment: Yeah, we need to settle the whole load_module() thing at PyCon because I'm tired of it hanging over our heads since the code is entirely structured to yank it out and if it's going to stay I want to clean up _bootstrap.py to make the code flow easier to follow.

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-16 Thread Nick Coghlan
Nick Coghlan added the comment: I'm still a fan of "never" - it's a good escape hatch that means we never have to contort the new API to deal with some of the more esoteric use cases that involved completely overloading the import process in the loader :) -- __

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-15 Thread Eric Snow
Eric Snow added the comment: Thanks for bringing this up, Brett. The goal and approach seem good to me. Did you bring this up during the PEP 451 discussions? If so, sorry I missed it. You've made a good point. And hopefully this will encourage people to subclass Loader more. :) -

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-15 Thread Eric Snow
Eric Snow added the comment: At some point should we make create_module (and exec_module) always required? In other words, when should would drop the legacy loader support? I expect the answer is Python 4. :) -- ___ Python tracker

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-12 Thread Brett Cannon
Brett Cannon added the comment: Here is a patch that makes sure that if exec_module() is defined then so is create_module(). There really isn't any benefit in the code now, but starting in Python 3.6 we can make a very clear code path delineation between spec-based loading and old-fashioned lo

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-12 Thread Brett Cannon
Brett Cannon added the comment: I don't think we really need to say anything. If people want default results, simply return None (which is handled for them by importlib.abc.Loader). The only thing changing here is that the method will now be required instead of optional. I'll post the patch h

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-11 Thread Nick Coghlan
Nick Coghlan added the comment: Sounds good to me. I'm not sure what to put in the docs about calling importlib.util.module_from_spec() from create_module() implementations. Really, if a loader can use that, then it should be doing whatever it was going to do after the call in exec_module() i

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-11 Thread Brett Cannon
Brett Cannon added the comment: OK, then why don't we just make create_module() a required method to use exec_module(), add a DeprecationWarning for when it isn't defined, leave Loader.create_module() as-is (already returns None), and then plan to make it a requirement in Python 3.6 since the

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-10 Thread Nick Coghlan
Nick Coghlan added the comment: The specific reason I wanted the "return None to delegate to the default behaviour" feature was to make it easier to migrate the C extension machinery. With that design, a PEP 451 based C extension loader would just need to return None when there was no appropri

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-10 Thread Brett Cannon
Brett Cannon added the comment: What do you think about requiring create_module() and/or not supporting a None value return? The only reason I ask is to think through the ramifications and how long to raise a DeprecationWarning. I think I can live with having a reasonable default if create_mod

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-09 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-09 Thread Nick Coghlan
Nick Coghlan added the comment: OK, that sounds good to me, then. From a compatibility perspective, a porting note for 3.5 should cover it. -- ___ Python tracker ___

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-09 Thread Brett Cannon
Brett Cannon added the comment: Fair enough. I have no qualms with keeping importlib.util.module_from_spec() and have Loader.create_module() just call module_from_spec(). -- ___ Python tracker

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-08 Thread Nick Coghlan
Nick Coghlan added the comment: I mostly like the idea, but am wary of having the base class implement it as a static method that subclasses are then likely to override with a normal instance method. A module level function somewhere + a base class instance method that just delegates to the stat

[issue23014] Don't have importlib.abc.Loader.create_module() be optional

2014-12-08 Thread Brett Cannon
New submission from Brett Cannon: I continue to be bothered by how we designed importlib.abc.Loader.create_module(). I don't like that it's optional and I don't like that it can return None. I would much rather make it so that importlib.abc.Loader.create_module() was a static method that does