Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Stop testing iterables for truthiness!
  • Loading branch information
sterliakov committed Jul 21, 2025
commit 82f3c7421fdd11422885698a33af2a64f63084ba
3 changes: 2 additions & 1 deletion mypy/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def solve_one(lowers: Iterable[Type], uppers: Iterable[Type]) -> Type | None:
uppers = new_uppers

# ...unless this is the only information we have, then we just pass it on.
lowers = list(lowers)
if not uppers and not lowers:
candidate = UninhabitedType()
candidate.ambiguous = True
Expand All @@ -285,7 +286,7 @@ def solve_one(lowers: Iterable[Type], uppers: Iterable[Type]) -> Type | None:
# This deviates from the general mypy semantics because
# recursive types are union-heavy in 95% of cases.
# Retain `None` when no bottoms were provided to avoid bogus `Never` inference.
bottom = UnionType.make_union(list(lowers))
bottom = UnionType.make_union(lowers)
else:
# The order of lowers is non-deterministic.
# We attempt to sort lowers because joins are non-associative. For instance:
Expand Down