attrs icon indicating copy to clipboard operation
attrs copied to clipboard

`__getattr__` in child class gets called when mixed with `cached_property`

Open dalejung opened this issue 1 month ago • 7 comments

from functools import cached_property
from attrs import define

@define
class Bob:
    @cached_property
    def howdy(self):
        return 3

class Sup(Bob):
    def __getattr__(self, name):
        raise AttributeError(name)

b = Sup()

# reaches __getattr__ where I raise AttributeError
b.howdy

This previously did not error. I would expect __getattr__ to not be called since the attribute exists.

dalejung avatar Jun 01 '24 20:06 dalejung