diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-03-22 18:57:28 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-03-22 19:03:27 +0900 |
commit | 5138255665f1c724bd0ac239add6cabd68f7a9d4 (patch) | |
tree | aa8cbf6404facb28ef4ccf04a56a413f16f52548 /sphinx/util/inspect.py | |
parent | eb00870b6fea858776ebfa4ed8ddd3cac540b013 (diff) | |
download | sphinx-git-5138255665f1c724bd0ac239add6cabd68f7a9d4.tar.gz |
Fix a cyfunction was considered as an attribute descriptor
Diffstat (limited to 'sphinx/util/inspect.py')
-rw-r--r-- | sphinx/util/inspect.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index d22df7656..855b11d83 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -197,6 +197,14 @@ def isabstractmethod(obj: Any) -> bool: return safe_getattr(obj, '__isabstractmethod__', False) is True +def is_cython_function_or_method(obj: Any) -> bool: + """Check if the object is a function or method in cython.""" + try: + return obj.__class__.__name__ == 'cython_function_or_method' + except AttributeError: + return False + + def isattributedescriptor(obj: Any) -> bool: """Check if the object is an attribute like descriptor.""" if inspect.isdatadescriptor(object): @@ -207,6 +215,9 @@ def isattributedescriptor(obj: Any) -> bool: if isfunction(obj) or isbuiltin(obj) or inspect.ismethod(obj): # attribute must not be either function, builtin and method return False + elif is_cython_function_or_method(obj): + # attribute must not be either function and method (for cython) + return False elif inspect.isclass(obj): # attribute must not be a class return False |