Skip to content

Commit f2734cc

Browse files
onursaticimvanderlee
authored andcommitted
support py3.6
1 parent 8b82276 commit f2734cc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

marshmallow_dataclass/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,8 +1044,13 @@ def _is_generic_alias_of_dataclass(clazz: type) -> bool:
10441044
Check if given class is a generic alias of a dataclass, if the dataclass is
10451045
defined as `class A(Generic[T])`, this method will return true if `A[int]` is passed
10461046
"""
1047-
return typing_inspect.is_generic_type(clazz) and dataclasses.is_dataclass(
1048-
typing_inspect.get_origin(clazz)
1047+
is_generic = typing_inspect.is_generic_type(clazz)
1048+
type_arguments = typing_inspect.get_args(clazz)
1049+
origin_class = typing_inspect.get_origin(clazz)
1050+
return (
1051+
is_generic
1052+
and len(type_arguments) > 0
1053+
and dataclasses.is_dataclass(origin_class)
10491054
)
10501055

10511056

0 commit comments

Comments
 (0)