8000 Allow isinstance/issubclass with nested tuples · python/mypy@aa15f40 · GitHub
[go: up one dir, main page]

Skip to content

Commit aa15f40

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

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mypy/checker.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,12 +2693,12 @@ 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]
2696+
all_types = [type_map[e] for e in flatten(expr)]
26972697

2698-
if isinstance(type, TupleType):
2699-
all_types = type.items
2700-
else:
2701-
all_types = [type]
2698+
#if isinstance(type, TupleType):
2699+
#all_types = type.items
2700+
#else:
2701+
#all_types = [type]
27022702

27032703
types = [] # type: List[Type]
27042704

0 commit comments

Comments
 (0)
0