Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inheritance resolution of cached properties in slotted class #1289

Closed
wants to merge 1 commit into from

Commits on Jun 3, 2024

  1. 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.
    
    See python-attrs#1288
    dlax committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    dd51026 View commit details
    Browse the repository at this point in the history