We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 29e0af6 commit de27c32Copy full SHA for de27c32
marshmallow_dataclass/__init__.py
@@ -827,8 +827,13 @@ def _is_generic_alias_of_dataclass(clazz: type) -> bool:
827
Check if given class is a generic alias of a dataclass, if the dataclass is
828
defined as `class A(Generic[T])`, this method will return true if `A[int]` is passed
829
"""
830
- return typing_inspect.is_generic_type(clazz) and dataclasses.is_dataclass(
831
- typing_inspect.get_origin(clazz)
+ is_generic = typing_inspect.is_generic_type(clazz)
+ type_arguments = typing_inspect.get_args(clazz)
832
+ origin_class = typing_inspect.get_origin(clazz)
833
+ return (
834
+ is_generic
835
+ and len(type_arguments) > 0
836
+ and dataclasses.is_dataclass(origin_class)
837
)
838
839
0 commit comments