-
Couldn't load subscription status.
- Fork 9
Open
Description
(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.
Lines 28 to 43 in 2f85525
| 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
- Kill __subclasscheck__ python/typing#283: Removed
UnionMetaand added_UnionandUnion - bpo-32226: PEP 560: improve typing module python/cpython#4906: Removed
_Union.Unionis now using the new class_SpecialForm.
Metadata
Metadata
Assignees
Labels
No labels