Skip to content

cached_property from python3.8 functools is not considered property #8103

Closed
@gaborbernat

Description

@gaborbernat
Contributor

It's because this property does not pass the check of isinstance(a, property) - see https://bugs.python.org/issue41523

https://github.com/sphinx-doc/sphinx/blob/3.x/sphinx/util/inspect.py#L305-L307 needs to change to:

from functools import cached_property

def isproperty(obj: Any) -> bool:
    """Check if the object is property."""	
    return isinstance(obj, (property, cached_property))

And guarded to be 3.8+.

Activity

added this to the 3.3.0 milestone on Aug 12, 2020
added a commit that references this issue on Aug 13, 2020

Fix sphinx-doc#8103: autodoc: cached_property is not considered as a …

088b049
added a commit that references this issue on Sep 15, 2020

Merge pull request #8111 from tk0miya/8103_cached_property

000210e
locked as resolved and limited conversation to collaborators on Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gaborbernat@tk0miya

        Issue actions

          cached_property from python3.8 functools is not considered property · Issue #8103 · sphinx-doc/sphinx