gh-101860: Expose __name__ on property (GH-101876)

Useful for introspection and consistent with functions and other
descriptors.
This commit is contained in:
Eugene Toder 2024-02-20 10:14:34 -05:00 committed by GitHub
parent 9af80ec83d
commit c0b0c2f201
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 158 additions and 25 deletions

View file

@ -127,9 +127,8 @@ def _finddoc(obj):
cls = self.__class__
# Should be tested before isdatadescriptor().
elif isinstance(obj, property):
func = obj.fget
name = func.__name__
cls = _findclass(func)
name = obj.__name__
cls = _findclass(obj.fget)
if cls is None or getattr(cls, name) is not obj:
return None
elif inspect.ismethoddescriptor(obj) or inspect.isdatadescriptor(obj):