diff options
author | 2019-03-25 13:01:13 -0700 | |
---|---|---|
committer | 2019-03-25 13:01:13 -0700 | |
commit | d1e768a67707bf7bb426c1537e1a764e89eaff78 (patch) | |
tree | eba1dc9c8a257e8c9fec36cef006eb06498d54ee /Lib/inspect.py | |
parent | Add note to Queue.get() docs about block=True (GH-2223) (diff) | |
download | cpython-d1e768a67707bf7bb426c1537e1a764e89eaff78.tar.gz cpython-d1e768a67707bf7bb426c1537e1a764e89eaff78.tar.bz2 cpython-d1e768a67707bf7bb426c1537e1a764e89eaff78.zip |
bpo-36326: Let inspect.getdoc() find docstrings for __slots__ (GH-12498)
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index b8a142232b8..8c398bd3534 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -582,9 +582,12 @@ def _finddoc(obj): cls = obj.__objclass__ if getattr(cls, name) is not obj: return None + if ismemberdescriptor(obj): + slots = getattr(cls, '__slots__', None) + if isinstance(slots, dict) and name in slots: + return slots[name] else: return None - for base in cls.__mro__: try: doc = getattr(base, name).__doc__ |