Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix inheritance resolution of cached properties in slotted class
This resolves the case where a sub-class of a slotted class defining some cached properties has a custom __getattr__() method. In that case, we need to build the custom __getattr__ implementation (see in _make_cached_property_getattr()) using cached properties from all classes in the MRO. In order to keep references of cached properties defined the inheritance hierarchy, we store them in a new __attrs_cached_properties__ attribute and finally build the "cached_properties" value, passed to _make_cached_property_getattr(), by combining current class' cached properties with that of all its parents. Also, when building __attrs_cached_properties__, we now clear current class' __dict__ (name 'cd'), thus saving an extra loop. Fix #1288
- Loading branch information