From 2232d9430c48afe771fce2b5b53a58611c036204 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Fri, 6 Aug 2021 10:54:41 -0400 Subject: [PATCH] FIX: do not try to compute the boolean value of a numpy array If there is a numpy array as a class attribute, then `bool(meth)` will raise. --- sphinx/util/inspect.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 2bb900bd7d1..d55ebceecbb 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -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