Skip to content

Commit

Permalink
Fix #9756: autodoc: Crashed if classmethod does not have __func__ att…
Browse files Browse the repository at this point in the history
…ribute
  • Loading branch information
tk0miya committed Oct 22, 2021
1 parent 6472fb9 commit ced8895
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 @@ -60,6 +60,7 @@ Bugs fixed
* #9657: autodoc: The base class for a subclass of mocked object is incorrect
* #9607: autodoc: Incorrect base class detection for the subclasses of the
generic class
* #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 ced8895

Please sign in to comment.