mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-36326: Let inspect.getdoc() find docstrings for __slots__ (GH-12498)
This commit is contained in:
parent
713a8ae792
commit
d1e768a677
6 changed files with 32 additions and 3 deletions
|
|
@ -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__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue