mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Close #19030: inspect.getmembers and inspect.classify_class_attrs
Order of search is now: 1. Try getattr 2. If that throws an exception, check __dict__ directly 3. If still not found, walk the mro looking for the eldest class that has the attribute (e.g. things returned by __getattr__) 4. If none of that works (e.g. due to a buggy __dir__, __getattr__, etc. method or missing __slot__ attribute), ignore the attribute entirely.
This commit is contained in:
parent
0e0cd46227
commit
63c141cacd
5 changed files with 131 additions and 39 deletions
|
@ -117,7 +117,7 @@ class DynamicClassAttribute:
|
|||
self.fset = fset
|
||||
self.fdel = fdel
|
||||
# next two lines make DynamicClassAttribute act the same as property
|
||||
self.__doc__ = doc or fget.__doc__ or self.__doc__
|
||||
self.__doc__ = doc or fget.__doc__
|
||||
self.overwrite_doc = doc is None
|
||||
# support for abstract methods
|
||||
self.__isabstractmethod__ = bool(getattr(fget, '__isabstractmethod__', False))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue