From 3be55dd2ca7746e2a17e56c9fdc56ea2a5fb0f15 Mon Sep 17 00:00:00 2001 From: Ghislain Vaillant Date: Thu, 10 Aug 2023 13:07:21 +0200 Subject: [PATCH] DOC: Fix linkcode resolving for attrs-defined classes --- docs/sphinxext/github_link.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/sphinxext/github_link.py b/docs/sphinxext/github_link.py index afce4e2883..1d19d71b47 100644 --- a/docs/sphinxext/github_link.py +++ b/docs/sphinxext/github_link.py @@ -45,7 +45,12 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision): class_name = info["fullname"].split(".")[0] module = __import__(info["module"], fromlist=[class_name]) - obj = attrgetter(info["fullname"])(module) + + # FIXME: Bypass resolving for attrs-defined classes. + try: + obj = attrgetter(info["fullname"])(module) + except AttributeError: + return # Unwrap the object to get the correct source # file in case that is wrapped by a decorator