sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.55k stars 2.12k forks source link

`inherited-members` does not work properly for slotted attributes #9583

Open Jackenmen opened 3 years ago

Jackenmen commented 3 years ago

Describe the bug

The inherited attributes from a slotted superclass are not shown when using inherited-members option in autodoc:

from typing import List

class Circle:
    """A class representing a circle."""
    __slots__ = ("radius",)

    def __init__(self, radius: int) -> None:
        #: Radius of a circle.
        self.radius = radius

class Pizza(Circle):
    """A class representing a pizza."""

    def __init__(self, ingredients: List[str]) -> None:
        #: List of ingredients.
        self.ingredients = ingredients

How to Reproduce

$ git clone https://github.com/jack1142/sphinx-issue-9583
$ cd sphinx-issue-9583
$ pip install sphinx
$ cd docs
$ make html
$ # open _build/html/index.html and see the issue

Expected behavior

I expected the inherited attributes to be shown.

Your project

https://github.com/jack1142/sphinx-issue-9583

Screenshots

Here's a link to generated docs: https://sphinx-issue-9583.readthedocs.io/en/latest/

OS

Windows 10, Ubuntu 18.04

Python version

3.7, 3.8, 3.9

Sphinx version

4.1.2

Sphinx extensions

sphinx.ext.autodoc

Extra tools

No response

Additional context

No response

FraDV0695 commented 1 month ago

Is there any update about this case? I've the same problem.