Skip to content

Commit 3639a43

Browse files
Attr: Improve robustness of skipping descriptors during instantiation.
1 parent 796109a commit 3639a43

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spec_classes/types/attr.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ def from_attr_value(cls, name, value, **kwargs):
126126
)
127127
else:
128128
# If attribute is a function or descriptor, we shouldn't interfere with them.
129-
if inspect.isfunction(value) or inspect.isdatadescriptor(value):
129+
if (
130+
inspect.isroutine(value)
131+
or inspect.ismethoddescriptor(value)
132+
or inspect.isdatadescriptor(value)
133+
):
130134
kwargs["is_masked"] = True
131135
attr_spec = Attr(default=value)
132136

0 commit comments

Comments
 (0)