Skip to content

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
@jbms jbms deleted the fix-autodoc-docstring-signature-for-init-and-new branch August 2, 2024 22:41
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.

2 participants