Skip to content

Commit 719237f

Browse files
Support nanobind methods in isattributedescriptor() (#13836)
With nanobind, ``nb_method`` is like ``instancemethod``, a specific ``__name__`` for methods.
1 parent 754864d commit 719237f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sphinx/util/inspect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ def isattributedescriptor(obj: Any) -> bool:
374374
if isinstance(unwrapped, _DESCRIPTOR_LIKE):
375375
# attribute must not be a method descriptor
376376
return False
377-
# attribute must not be an instancemethod (C-API)
378-
return type(unwrapped).__name__ != 'instancemethod'
377+
# attribute must not be an instancemethod (C-API) nor nb_method (specific for nanobind)
378+
return type(unwrapped).__name__ not in {'instancemethod', 'nb_method'}
379379
return False
380380

381381

0 commit comments

Comments
 (0)