Skip to content

Commit ced8895

Browse files
committed
Fix sphinx-doc#9756: autodoc: Crashed if classmethod does not have __func__ attribute
1 parent 6472fb9 commit ced8895

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
@@ -60,6 +60,7 @@ Bugs fixed
6060
* #9657: autodoc: The base class for a subclass of mocked object is incorrect
6161
* #9607: autodoc: Incorrect base class detection for the subclasses of the
6262
generic class
63+
* #9756: autodoc: Crashed if classmethod does not have __func__ attribute
6364
* #9630: autosummary: Failed to build summary table if :confval:`primary_domain`
6465
is not 'py'
6566
* #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)