-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-37800: Clean up importlib documentation for some module attributes #10016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* The ``loader`` attribute is not `None` for namespace packages (see https://stackoverflow.com/questions/52869541/namespace-package-loader-attribute-not-set-to-none). * The ``submodule_search_locations `` attribute is not `None` for non-package modules, it is not set (see https://docs.python.org/3/reference/import.html#__path__). * The ``cached `` attribute is not sometimes `None`, it is sometimes not set (see https://docs.python.org/3/reference/import.html#__cached__). * The ``parent `` attribute is not `None` but the empty string for non-package top-level modules (see https://docs.python.org/3/reference/import.html#__package__).
There seems to be some misconceptions here, a ModuleSpec object is different from the attributes set on modules. Those attributes do get set (or not set) based on the ModuleSpec object but the docs aren't referring to them. I think the confusion aroused from the format in which the docs present this information. The module's attributes don't exactly reflect the ModuleSpecs' from which they originate from as you've said, yet the docs act like they do. If there is a change to be had, I'd suggest clarifying that they aren't always equal or, if the behavior of |
@orlnub123 I disagree here. The values of the attributes of a module and the attributes of its
Try to import a namespace package and you will see that both And you can verify my three other claims as well. |
My bad, I didn't know the spec's loader got mutated which is a bit intriguing to be honest. I do agree that they are equivalent after learning about that, guess I had some misconceptions of my own. I still do think there is some confusion. Where the docs state that they can be set to One thing I did notice that is indeed wrong is that the ModuleSpec's parent attribute never returns |
@orlnub123 My bad too, my claims for the |
The loader attribute is a bit of an edge case. You would initially set it to |
@orlnub123 Thank you for the PEP reference. I have just emailed the author Eric Snow so that he could give us his thought. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for helping to improve the documentation. I like your changes, although I have a few grammatical suggestions.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
@warsaw Thank you for the review. I have updated the pull request. |
@warsaw are you available to review again? |
While we wait to hear back from @warsaw , one comment I have is there seems to be a loss of detail on the |
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Yeah, this is worth following through. Sorry it's dragged on so long. I'm going to prioritize getting this wrapped up ASAP. |
I have made the requested changes; please review again.
Thanks for looking at this @ericsnowcurrently! I have applied all your suggestions. |
Thanks for making the requested changes! @ericsnowcurrently, @brettcannon, @warsaw, @JulienPalard: please review the changes made to this pull request. |
@ericsnowcurrently can you have a look? |
Yeah, sorry, today or tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. Thanks so much for your patience, thoughtfulness, and diligence!!!
I've left a few comments, one of which is a minor nit, one is a potentially incorrect (or confusing) phrase, and the last is just a reminder (with nothing to change). I'm approving the PR under the assumption that you will make any necessary corrections before this gets merged (in case I'm not the one to merge it).
Thanks again!
Co-authored-by: Eric Snow <[email protected]>
Co-authored-by: Eric Snow <[email protected]>
@maggyero: Status check is done, and it's a success ✅ . |
@brettcannon Thanks for helping us complete this PR! @ericsnowcurrently Thanks for your multiple careful reviews! And thanks to the other reviewers. |
Thanks for your patience, @maggyero! Congrats on getting this merged. |
pythonGH-10016) Automerge-Triggered-By: GH:brettcannon
https://bugs.python.org/issue37800
Automerge-Triggered-By: GH:brettcannon