Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas A Caswell <tcaswell@gmail.com>2021-08-06 17:54:41 +0300
committerThomas A Caswell <tcaswell@gmail.com>2021-08-06 18:00:00 +0300
commit2232d9430c48afe771fce2b5b53a58611c036204 (patch)
tree13d056415bf1cb16ea626ae9770bcfda04369931 /sphinx/util
parent6ac326e019db949c2c8d58f523c2534be36d4e62 (diff)
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.
Diffstat (limited to 'sphinx/util')
-rw-r--r--sphinx/util/inspect.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
index 2bb900bd7..d55ebceec 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