Skip to content

Commit 666038d

Browse files
committed
fix(method): improve classmethod detection using MRO inspection
1 parent 28b3a7a commit 666038d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

objinspect/method.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ def is_static(self) -> bool:
5151

5252
@property
5353
def is_classmethod(self) -> bool:
54-
return hasattr(self.func, "__self__")
54+
for cls in inspect.getmro(self.cls):
55+
if self.name in cls.__dict__:
56+
return isinstance(cls.__dict__[self.name], classmethod)
57+
return False
5558

5659
@property
5760
def is_property(self) -> bool:

0 commit comments

Comments
 (0)