Skip to content

Commit

Permalink
Use _get_annotations rather than branching on class dict entry
Browse files Browse the repository at this point in the history
  • Loading branch information
diabolo-dan committed Nov 17, 2023
1 parent 80e8a6b commit b0d87e3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/attr/_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,11 +920,11 @@ def _create_slots_class(self):
# Clear out function from class to avoid clashing.
del cd[name]

if "__annotations__" in cd:
for name, func in cached_properties.items():
annotation = inspect.signature(func).return_annotation
if annotation is not inspect.Parameter.empty:
cd["__annotations__"][name] = annotation
class_annotations = _get_annotations(self._cls)
for name, func in cached_properties.items():
annotation = inspect.signature(func).return_annotation
if annotation is not inspect.Parameter.empty:
class_annotations[name] = annotation

original_getattr = cd.get("__getattr__")
if original_getattr is not None:
Expand Down

0 comments on commit b0d87e3

Please sign in to comment.