-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add support for singledispatchmethod class methods in MethodDocumenter #11284
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
picnixz
force-pushed
the
fix-11278
branch
2 times, most recently
from
April 3, 2023 13:43
8035c62
to
a859d30
Compare
Since we are dropping 3.8 support, I'll clean this PR when I've got time. |
I wanted to rename some branch but it closed the PR. So I'll stick with an old name. |
I've had this PR for a long time and nothing has ever changed, so let's merge this one now. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #11278.
Fix #11531.
Details:
:classmethod:
directive option for@classmethod
combined with@singledispatchmethod
.There is some decision making to doc for this feature concerning the compatibility for Python versions up to 3.9 (excluded), so I want to get some feedback before merging.Prior to Python 3.9Legacy comment
If a method is decorated with
@singledispatchmethod
and@classmethod
, theMethodDocumenter
miserably fails to extract the correct signature or docstring. However, in order to properly extract the signature or the docstring, this would require a lot of changes in thesphinx.util.inspect
orsphinx.ext.autodoc
module which may break other things.Therefore, I think it would be better to say "autodocumenting a singledispatched classmethod works assuming that Sphinx is running Python 3.9 or later".