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 52e25f8 commit 28a47aaCopy full SHA for 28a47aa
marshmallow_dataclass/__init__.py
@@ -854,8 +854,13 @@ def _is_generic_alias_of_dataclass(clazz: type) -> bool:
854
Check if given class is a generic alias of a dataclass, if the dataclass is
855
defined as `class A(Generic[T])`, this method will return true if `A[int]` is passed
856
"""
857
- return typing_inspect.is_generic_type(clazz) and dataclasses.is_dataclass(
858
- typing_inspect.get_origin(clazz)
+ is_generic = typing_inspect.is_generic_type(clazz)
+ type_arguments = typing_inspect.get_args(clazz)
859
+ origin_class = typing_inspect.get_origin(clazz)
860
+ return (
861
+ is_generic
862
+ and len(type_arguments) > 0
863
+ and dataclasses.is_dataclass(origin_class)
864
)
865
866
0 commit comments