Skip to content

Commit 9783ba7

Browse files
committed
try supporting old autodoc_attrgettrs attribute as well as new autodoc_attrgetters attribute
1 parent 183ea89 commit 9783ba7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/sage_docbuild/ext/sage_autodoc.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3024,9 +3024,14 @@ def _get_property_getter(self) -> Callable | None:
30243024

30253025
def autodoc_attrgetter(app: Sphinx, obj: Any, name: str, *defargs: Any) -> Any:
30263026
"""Alternative getattr() for types"""
3027-
for typ, func in app.registry.autodoc_attrgetters.items():
3028-
if isinstance(obj, typ):
3029-
return func(obj, name, *defargs)
3027+
try:
3028+
for typ, func in app.registry.autodoc_attrgetters.items():
3029+
if isinstance(obj, typ):
3030+
return func(obj, name, *defargs)
3031+
except AttributeError:
3032+
for typ, func in app.registry.autodoc_attrgettrs.items():
3033+
if isinstance(obj, typ):
3034+
return func(obj, name, *defargs)
30303035

30313036
return safe_getattr(obj, name, *defargs)
30323037

0 commit comments

Comments
 (0)