diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-10-29 06:17:10 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-10-29 06:17:10 (GMT) |
commit | 6230235e833bedfc1b4b6c1aba1d6fa8b616d1b1 (patch) | |
tree | b17b4d96453144cde2a4398818332cf7256a7f17 /Lib/inspect.py | |
parent | 2e0e18ba57ba4d8eb438734e2dc57bce0071f471 (diff) | |
parent | ac4bdcc80e986bdd5b9d10ab0bce35aabb790a3e (diff) | |
download | cpython-6230235e833bedfc1b4b6c1aba1d6fa8b616d1b1.zip cpython-6230235e833bedfc1b4b6c1aba1d6fa8b616d1b1.tar.gz cpython-6230235e833bedfc1b4b6c1aba1d6fa8b616d1b1.tar.bz2 |
Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties.
Original patch by John Mark Vandenberg.
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 a089be6..7615e52 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 |