Skip to content

Commit

Permalink
Attr: Improve robustness of skipping descriptors during instantiation.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewwardrop committed Jan 13, 2025
1 parent 796109a commit 3639a43
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec_classes/types/attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ def from_attr_value(cls, name, value, **kwargs):
)
else:
# If attribute is a function or descriptor, we shouldn't interfere with them.
if inspect.isfunction(value) or inspect.isdatadescriptor(value):
if (
inspect.isroutine(value)
or inspect.ismethoddescriptor(value)
or inspect.isdatadescriptor(value)
):
kwargs["is_masked"] = True
attr_spec = Attr(default=value)

Expand Down

0 comments on commit 3639a43

Please sign in to comment.