summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-10-29 06:15:50 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-10-29 06:15:50 (GMT)
commitac4bdcc80e986bdd5b9d10ab0bce35aabb790a3e (patch)
treeab7584880b723f516f0ac580241396e850128a63 /Lib/inspect.py
parentf8152c67f52874cd4aa63f1cb3e1216382f98057 (diff)
downloadcpython-ac4bdcc80e986bdd5b9d10ab0bce35aabb790a3e.zip
cpython-ac4bdcc80e986bdd5b9d10ab0bce35aabb790a3e.tar.gz
cpython-ac4bdcc80e986bdd5b9d10ab0bce35aabb790a3e.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.py13
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