@@ -903,7 +903,7 @@ def _create_slots_class(self):
903903 names += ("__weakref__" ,)
904904
905905 cached_properties = {
906- name : cached_prop . func
906+ name : cached_prop
907907 for name , cached_prop in cd .items ()
908908 if isinstance (cached_prop , cached_property )
909909 }
@@ -912,8 +912,11 @@ def _create_slots_class(self):
912912 # To know to update them.
913913 additional_closure_functions_to_update = []
914914 if cached_properties :
915+ # Store cached property functions for the autodoc extension to read
916+ cd ["__attrs_cached_properties__" ] = cached_properties
915917 class_annotations = _get_annotations (self ._cls )
916- for name , func in cached_properties .items ():
918+ for name , prop in cached_properties .items ():
919+ func = prop .func
917920 # Add cached properties to names for slotting.
918921 names += (name ,)
919922 # Clear out function from class to avoid clashing.
@@ -928,7 +931,9 @@ def _create_slots_class(self):
928931 additional_closure_functions_to_update .append (original_getattr )
929932
930933 cd ["__getattr__" ] = _make_cached_property_getattr (
931- cached_properties , original_getattr , self ._cls
934+ {name : prop .func for (name , prop ) in cached_properties .items ()},
935+ original_getattr ,
936+ self ._cls
932937 )
933938
934939 # We only add the names of attributes that aren't inherited.
0 commit comments