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

An annotated instance variable on super class is not documented when derived class has other annotated instance variables #8041

Closed
tk0miya opened this issue Aug 2, 2020 · 0 comments

Comments

@tk0miya
Copy link
Member

tk0miya commented Aug 2, 2020

Describe the bug
An annotated instance variable on super class is not documented when derived class has other annotated instance variables

To Reproduce
Steps to reproduce the behavior:

# example.py
class Foo:
    var1: int


class Bar(Foo):
    var2: int
# index.rst
.. automodule:: example
   :members:
   :undoc-members:
   :inherited-members:

Bar.var1 is not shown even if :inherited-members: option given.

Expected behavior
Both var1 and var2 are shown.

Your project
No

Screenshots
No

Environment info

  • OS: Mac
  • Python version: 3.8.2
  • Sphinx version: HEAD of 3.x
  • Sphinx extensions: sphinx.ext.autodoc
@tk0miya tk0miya added this to the 3.2.0 milestone Aug 2, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Aug 2, 2020
…xpectedly

An annotated instance variable on super class is not documented when
derived class has also other annotated instance variables because
`obj.__annotations__` is overrided by derived class's type hints.

To get annotations of the target class correctly, this scans MRO to
get all of annotated instance variables.
tk0miya added a commit to tk0miya/sphinx that referenced this issue Aug 3, 2020
…xpectedly

An annotated instance variable on super class is not documented when
derived class has also other annotated instance variables because
`obj.__annotations__` is overrided by derived class's type hints.

To get annotations of the target class correctly, this scans MRO to
get all of annotated instance variables.
@tk0miya tk0miya closed this as completed in 88b2ec6 Aug 7, 2020
tk0miya added a commit that referenced this issue Aug 7, 2020
Fix #8041: autodoc: An ivar on super class is not shown unexpectedly
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant