Skip to content
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

Fix autodoc_docstring_signature support for __init__ and __new__ #9518

Conversation

jbms
Copy link
Contributor

@jbms jbms commented Jul 31, 2021

Feature or Bugfix

  • Bugfix

Purpose

The MethodDocumenter.get_doc method added by
51ae283 prevents
DocstringSignatureMixin from working correctly for __init__ and
__new__ methods. Additionally, the __new__ docstring was not obtained
correctly.

This commit checks for self._new_docstrings being set, and also
corrects the logic for obtaining the __new__ docstring.

There still remains the issue that when the class signature is
obtained from the signature of __init__ or __new__, only the real
signature is used, due to the use of sphinx.util.inspect.signature;
the autodoc_docstring_signature option does not have any effect.

The `MethodDocumenter.get_doc` method added by
51ae283 prevents
DocstringSignatureMixin from working correctly for __init__ and
__new__ methods.  Additionally, the __new__ docstring was not obtained
correctly.

This commit checks for `self._new_docstrings` being set, and also
corrects the logic for obtaining the __new__ docstring.

There still remains the issue that when the class signature is
obtained from the signature of __init__ or __new__, only the real
signature is used, due to the use of `sphinx.util.inspect.signature`;
the autodoc_docstring_signature option does not have any effect.
@tk0miya tk0miya added this to the 4.2.0 milestone Aug 1, 2021
@tk0miya tk0miya added type:bug and removed blocked labels Aug 1, 2021
@tk0miya tk0miya merged commit 1cdde3d into sphinx-doc:4.x Aug 1, 2021
@tk0miya
Copy link
Member

tk0miya commented Aug 1, 2021

Thanks!

tk0miya added a commit that referenced this pull request Aug 1, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants