Skip to content

Commit f00e8f8

Browse files
author
Bahtya
committed
fix: remove redundant get_proper_type() call in checker.py
The make_simplified_union return type is already specific enough for isinstance check, no need to unwrap further. Bahtya
1 parent 94c063c commit f00e8f8

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

mypy/checker.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8042,11 +8042,7 @@ def get_type_range_of_type(self, typ: Type) -> TypeRange | None:
80428042
# type precision (e.g. from a widened _ClassInfo alias). Return None
80438043
# to avoid narrowing to a useless type.
80448044
item = make_simplified_union([t.item for t in valid_ranges])
8045-
proper_item = get_proper_type(item)
8046-
if (
8047-
isinstance(proper_item, Instance)
8048-
and proper_item.type.fullname == "builtins.object"
8049-
):
8045+
if isinstance(item, Instance) and item.type.fullname == "builtins.object":
80508046
return None
80518047
return TypeRange(item, is_upper_bound=True)
80528048
if isinstance(typ, FunctionLike) and typ.is_type_obj():

0 commit comments

Comments
 (0)