File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,12 @@ def is_array_container_type(cls: type) -> bool:
173173 function will say that :class:`numpy.ndarray` is an array container
174174 type, only object arrays *actually are* array containers.
175175 """
176- return (
176+ # NOTE: `is_array_container_type` is used in `dataclass_array_container`
177+ # where it looks at field types. The fields can contain typing information
178+ # like `typing.Optional[MyType]`, which does not have an `__mro__` and messes
179+ # up `singledispatch.dispatch`, so we check for that first
180+
181+ return hasattr (cls , "__mro__" ) and (
177182 cls is ArrayContainer
178183 or (serialize_container .dispatch (cls )
179184 is not serialize_container .__wrapped__ )) # type:ignore[attr-defined]
You can’t perform that action at this time.
0 commit comments