From 623f01f49ec32c7a126d3c9ef853f78e6b5601af Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Sat, 29 Jul 2023 14:16:42 -0700 Subject: [PATCH] code review --- mypy/checker.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mypy/checker.py b/mypy/checker.py index c7910b6d723f..2a9fdcb375ac 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -4592,14 +4592,11 @@ def analyze_iterable_item_type(self, expr: Expression) -> tuple[Type, Type]: if int_type: return iterator, int_type - if isinstance(iterable, TupleType): + if ( + isinstance(iterable, TupleType) + and iterable.partial_fallback.type.fullname == "builtins.tuple" + ): joined: Type = UninhabitedType() - if iterable.partial_fallback.type.fullname != "builtins.tuple": - # If we're some fancier tuple variant, join with the item type - item_type = echk.check_method_call_by_name("__next__", iterator, [], [], expr)[0] - if not isinstance(get_proper_type(item_type), AnyType): - joined = item_type - for item in iterable.items: joined = join_types(joined, item) return iterator, joined