Skip to content

Overridden classmethod documentation not inherited with autodoc #9757

@EpicWink

Description

@EpicWink

Describe the bug

The documentation for a classmethod in a parent class is not inherited by the method re-defined (without documentation) in a child class

How to Reproduce

Module src/spam.py:

class Parent:
    @classmethod
    def method(cls) -> int:
        """Return an integer."""
        return 17


class Child(Parent):
    @classmethod
    def method(cls):
        return 42

Sphinx configuration docs/conf.py:

project = "spam"
extensions = ["sphinx.ext.autodoc"]

Documentation index docs/index.rst:

spam
====

.. automodule:: spam
   :members:
   :undoc-members:

Build:

PYTHONPATH=src sphinx-build docs/ build

Expected behavior

Overridden classmethod to inherit documentation from parent class

Your project

https://github.com/EpicWink/python-swf-typed

Screenshots

Screenshot from 2021-10-21 20-13-39

OS

Ubuntu 20.04

Python version

3.8

Sphinx version

4.2.0

Sphinx extensions

sphinx.ext.autodoc

Additional context

inspect.getdoc(Child.method) returns the expected value

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions