mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix a cyfunction was considered as an attribute descriptor
This commit is contained in:
parent
eb00870b6f
commit
5138255665
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user