Skip to content

Compatibility issue with Python 3.7 #117

Open
@AiOO

Description

@AiOO

(This is not the same issue with as #116)

Since the typing module in Python 3.7 doesn't have _Union class, AttributeError occurs by below lines. To support Python 3.7 it should be fixed.

if hasattr(typing, '_Union'):
def is_union_type(type_):
return isinstance(type_, typing._Union)
def get_union_types(type_):
if is_union_type(type_):
return type_.__args__
else:
def is_union_type(type_):
return isinstance(type_, typing.UnionMeta)
def get_union_types(type_):
if is_union_type(type_):
return type_.__union_params__ \
if hasattr(type_, '__union_params__') \
else type_.__args__

p.s. @kanghyojun Could you explain why you used _Union instead of Union?

Relative links

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions