Skip to content

Commit

Permalink
Merge pull request #9760 from tk0miya/9756_classmethod_not_having_func
Browse files Browse the repository at this point in the history
Fix #9756: autodoc: Crashed if classmethod does not have __func__ attribute
  • Loading branch information
tk0miya committed Oct 26, 2021
2 parents d8b92bb + 096108c commit a16baf1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -63,6 +63,7 @@ Bugs fixed
generic class
* #9755: autodoc: memory addresses are shown for aliases
* #9752: autodoc: Failed to detect type annotation for slots attribute
* #9756: autodoc: Crashed if classmethod does not have __func__ attribute
* #9630: autosummary: Failed to build summary table if :confval:`primary_domain`
is not 'py'
* #9670: html: Fix download file with special characters
Expand Down
2 changes: 1 addition & 1 deletion sphinx/util/inspect.py
Expand Up @@ -865,7 +865,7 @@ def getdoc(obj: Any, attrgetter: Callable = safe_getattr,
if cls and name and isclassmethod(obj, cls, name):
for basecls in getmro(cls):
meth = basecls.__dict__.get(name)
if meth:
if meth and hasattr(meth, '__func__'):
return getdoc(meth.__func__)

doc = attrgetter(obj, '__doc__', None)
Expand Down

0 comments on commit a16baf1

Please sign in to comment.