| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
* 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 __loader__ for namespace packages changes, that they aren't always defined. |
Sorry, something went wrong.
|
@orlnub123 I disagree here. The values of the attributes of a module and the attributes of its __spec__ attribute are equivalent, it is just that there are not synchronized, as the documentation already states clearly:
Try to import a namespace package and you will see that both package.__spec__.loader and package.__loader__ attributes are not None, contrary to what the documentation states. And you can verify my three other claims as well. |
Sorry, something went wrong.
|
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 None, it's referring to the attributes on the spec. For example if the spec sets submodule_search_locations to None, the corresponding module's __path__ attribute doesn't get defined. That doesn't mean you can return a spec which doesn't have a submodule_search_locations attribute defined, that would lead to an error. One thing I did notice that is indeed wrong is that the ModuleSpec's parent attribute never returns None. According to PEP 366 setting it to None is fine, as the import system corrects it later on. This makes me question whether the docs are there to help you create your own arbitrary spec object, or to specifically document the ModuleSpec. |
Sorry, something went wrong.
|
@orlnub123 My bad too, my claims for the submodule_search_locations and the cached attributes were wrong. I only checked the representation of the module.__spec__ attribute, which does not display its None attributes, so I thought there were not set, but calling explicitly module.__spec__. submodule_search_locations and module.__spec__.cached does yield None (not an AttributeError). I have updated the pull request and its description accordingly. |
Sorry, something went wrong.
|
The loader attribute is a bit of an edge case. You would initially set it to None when creating the spec for namespace packages as talked about in PEP 451, but it would then get mutated to a non-none value after module creation. I don't think removing any mention about this would be a good idea. |
Sorry, something went wrong.
|
@orlnub123 Thank you for the PEP reference. I have just emailed the author Eric Snow so that he could give us his thought. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for helping to improve the documentation. I like your changes, although I have a few grammatical suggestions.
Sorry, something went wrong.
|
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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
|
@warsaw Thank you for the review. I have updated the pull request. |
Sorry, something went wrong.
|
@warsaw are you available to review again? |
Sorry, something went wrong.
|
While we wait to hear back from @warsaw , one comment I have is there seems to be a loss of detail on the ModuleSpec docs but an increase on the load_module() docs which is actually the reverse of how I would expect it to go (especially since load_module() is deprecated). |
Sorry, something went wrong.
|
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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Brett Cannon <brett@python.org>
Thanks @brettcannon, I have made the requested changes; please review again. About the three remaining open conversations with @ericsnowcurrently, I have addressed them but got no feedback since. Should I mark them resolved myself? |
Sorry, something went wrong.
|
Thanks for making the requested changes! @JulienPalard, @ericsnowcurrently, @warsaw, @brettcannon: please review the changes made to this pull request. |
Sorry, something went wrong.
|
@maggyero if you believe you are resolved you can mark them as resolved yourself. |
Sorry, something went wrong.
Alright, but since he was heavily involved in the review of this PR and he is the author of PEP 451, I prefer to ask him a last time before we merge this. @ericsnowcurrently, if you are not too busy, do you agree with my updates in the three remaining open conversations? If you are still interested in seeing this PR merged, please let me know. Otherwise I am fine with closing it. |
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry I didn't get back to this sooner! You've been so patient. Thank you.
There are just a few things that hadn't been addressed since my last review. I've add a few other minor suggestions.
Sorry, something went wrong.
|
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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
Yeah, this is worth following through. Sorry it's dragged on so long. I'm going to prioritize getting this wrapped up ASAP. |
Sorry, something went wrong.
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
I have made the requested changes; please review again.
Thanks for looking at this @ericsnowcurrently! I have applied all your suggestions. |
Sorry, something went wrong.
|
Thanks for making the requested changes! @ericsnowcurrently, @brettcannon, @warsaw, @JulienPalard: please review the changes made to this pull request. |
Sorry, something went wrong.
|
Yeah, sorry, today or tomorrow. |
Sorry, something went wrong.
There was a problem hiding this comment.
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!
Sorry, something went wrong.
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
@maggyero: Status check is done, and it's a success ✅ . |
Sorry, something went wrong.
|
@brettcannon Thanks for helping us complete this PR! @ericsnowcurrently Thanks for your multiple careful reviews! And thanks to the other reviewers. |
Sorry, something went wrong.
|
Thanks for your patience, @maggyero! Congrats on getting this merged. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
https://bugs.python.org/issue37800
Automerge-Triggered-By: GH:brettcannon