mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-131116: Fix inspect.getdoc() to work with cached_property objects (GH-131165)
This commit is contained in:
parent
23d85a2a3f
commit
70748bdbea
5 changed files with 70 additions and 0 deletions
|
|
@ -747,6 +747,12 @@ def _finddoc(obj, *, search_in_class=True):
|
|||
cls = _findclass(obj.fget)
|
||||
if cls is None or getattr(cls, name) is not obj:
|
||||
return None
|
||||
# Should be tested before ismethoddescriptor()
|
||||
elif isinstance(obj, functools.cached_property):
|
||||
name = obj.attrname
|
||||
cls = _findclass(obj.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__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue