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 #9250: autodoc: autodoc_inherited_docstrings doesn't effect to classes #9262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tk0miya
Copy link
Member

@tk0miya tk0miya commented May 22, 2021

Feature or Bugfix

  • Bugfix

Purpose

@tk0miya tk0miya added this to the 4.1.0 milestone May 22, 2021
@tk0miya tk0miya force-pushed the 9250_autodoc_inherited_docstrings_for_classes branch from 6618935 to 99e3736 Compare May 23, 2021 16:28
…fect to classes

The docstring of the superclass is not extracted even if the docstring
of the subclass is empty and autodoc_inherited_docstrings=True.

This adds `sphinx.util.inspect.getclassdoc()` to respect the configuration
on getting docstring.
@tk0miya tk0miya force-pushed the 9250_autodoc_inherited_docstrings_for_classes branch from 99e3736 to 26e861b Compare May 23, 2021 16:39
if not allow_inherited:
return safe_getattr(obj, '__doc__', None)
else:
for basecls in getmro(obj)[:-1]:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This excepts the object class. But other built-in classes are not excepted yet. So the docstring of list, dict, str, int and so on are fetched. I think it's an unexpected broken change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh...

>>> inspect.isbuiltin(list)
False
>>> list.__module__
'builtins'

@tk0miya tk0miya modified the milestones: 4.1.0, 4.2.0 Jul 10, 2021
@tk0miya tk0miya modified the milestones: 4.2.0, 4.3.0 Sep 12, 2021
@tk0miya tk0miya modified the milestones: 4.3.0, 4.4.0 Nov 8, 2021
@tk0miya tk0miya modified the milestones: 4.4.0, 4.5.0 Jan 13, 2022
@tk0miya tk0miya modified the milestones: 4.5.0, 5.0.0 Mar 27, 2022
@tk0miya tk0miya modified the milestones: 5.0.0, 5.x May 2, 2022
@tk0miya tk0miya changed the base branch from 4.x to 5.x May 22, 2022 12:58
@AA-Turner AA-Turner modified the milestones: 5.x, 6.x Oct 4, 2022
@AA-Turner AA-Turner changed the base branch from 5.x to master October 16, 2022 15:25
@AA-Turner AA-Turner modified the milestones: 6.x, 7.x Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants