Skip to content

Commit de27c32

Browse files
committed
support py3.6
1 parent 29e0af6 commit de27c32

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
@@ -827,8 +827,13 @@ def _is_generic_alias_of_dataclass(clazz: type) -> bool:
827827
Check if given class is a generic alias of a dataclass, if the dataclass is
828828
defined as `class A(Generic[T])`, this method will return true if `A[int]` is passed
829829
"""
830-
return typing_inspect.is_generic_type(clazz) and dataclasses.is_dataclass(
831-
typing_inspect.get_origin(clazz)
830+
is_generic = typing_inspect.is_generic_type(clazz)
831+
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)
832837
)
833838

834839

0 commit comments

Comments
 (0)