Skip to content

Commit a16baf1

Browse files
authored
Merge pull request sphinx-doc#9760 from tk0miya/9756_classmethod_not_having_func
Fix sphinx-doc#9756: autodoc: Crashed if classmethod does not have __func__ attribute
2 parents d8b92bb + 096108c commit a16baf1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Bugs fixed
6363
generic class
6464
* #9755: autodoc: memory addresses are shown for aliases
6565
* #9752: autodoc: Failed to detect type annotation for slots attribute
66+
* #9756: autodoc: Crashed if classmethod does not have __func__ attribute
6667
* #9630: autosummary: Failed to build summary table if :confval:`primary_domain`
6768
is not 'py'
6869
* #9670: html: Fix download file with special characters

sphinx/util/inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ def getdoc(obj: Any, attrgetter: Callable = safe_getattr,
865865
if cls and name and isclassmethod(obj, cls, name):
866866
for basecls in getmro(cls):
867867
meth = basecls.__dict__.get(name)
868-
if meth:
868+
if meth and hasattr(meth, '__func__'):
869869
return getdoc(meth.__func__)
870870

871871
doc = attrgetter(obj, '__doc__', None)

0 commit comments

Comments
 (0)