Skip to content

Commit

Permalink
FIX: do not try to compute the boolean value of a numpy array
Browse files Browse the repository at this point in the history
If there is a numpy array as a class attribute, then `bool(meth)` will
raise.
  • Loading branch information
tacaswell committed Aug 6, 2021
1 parent 6ac326e commit 2232d94
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sphinx/util/inspect.py
Expand Up @@ -255,9 +255,10 @@ def isclassmethod(obj: Any, cls: Any = None, name: str = None) -> bool:
elif inspect.ismethod(obj) and obj.__self__ is not None and isclass(obj.__self__):
return True
elif cls and name:
placeholder = object()
for basecls in getmro(cls):
meth = basecls.__dict__.get(name)
if meth:
meth = basecls.__dict__.get(name, placeholder)
if meth is not placeholder:
return isclassmethod(meth)

return False
Expand Down

0 comments on commit 2232d94

Please sign in to comment.