diff options
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index bf4f87d..b65bec7 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -527,17 +527,18 @@ def _finddoc(obj): cls = self else: cls = self.__class__ - elif ismethoddescriptor(obj) or isdatadescriptor(obj): - name = obj.__name__ - cls = obj.__objclass__ - if getattr(cls, name) is not obj: - return None + # Should be tested before isdatadescriptor(). elif isinstance(obj, property): - func = f.fget + func = obj.fget name = func.__name__ cls = _findclass(func) if cls is None or getattr(cls, name) is not obj: return None + elif ismethoddescriptor(obj) or isdatadescriptor(obj): + name = obj.__name__ + cls = obj.__objclass__ + if getattr(cls, name) is not obj: + return None else: return None |