From 3639a43a408befeccbbb92ae752fd446d2183b90 Mon Sep 17 00:00:00 2001 From: Matthew Wardrop Date: Mon, 13 Jan 2025 12:31:04 -0800 Subject: [PATCH] Attr: Improve robustness of skipping descriptors during instantiation. --- spec_classes/types/attr.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec_classes/types/attr.py b/spec_classes/types/attr.py index a453e4a..7bd69d3 100644 --- a/spec_classes/types/attr.py +++ b/spec_classes/types/attr.py @@ -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)