Skip to content

Commit 3f1e988

Browse files
committed
Allow isinstance/issubclass with nested tuples
1 parent 81df467 commit 3f1e988

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

mypy/checker.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,12 +2693,7 @@ def flatten(t: Expression) -> List[Expression]:
26932693

26942694

26952695
def get_isinstance_type(expr: Expression, type_map: Dict[Expression, Type]) -> Type:
2696-
type = type_map[expr]
2697-
2698-
if isinstance(type, TupleType):
2699-
all_types = type.items
2700-
else:
2701-
all_types = [type]
2696+
all_types = [type_map[e] for e in flatten(expr)]
27022697

27032698
types = [] # type: List[Type]
27042699

0 commit comments

Comments
 (0)