Skip to content
Closed
Changes from all commits
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
7 changes: 6 additions & 1 deletion mypy/binder.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,12 @@ def update_from_options(self, frames: list[Frame]) -> bool:
# See check-isinstance.test::testNoneCheckDoesNotMakeTypeVarOptional
# This is a safe assumption: the fact that we checked something with `is`
# or `isinstance` does not change the type of the value.
continue
if len(frames) == 1:
# This is likely a sequential update, not a merge of
# conditional branches. Let the update proceed to preserve narrowing.
pass
else:
continue

# Remove exact duplicates to save pointless work later, this is
# a micro-optimization for --allow-redefinition-new.
Expand Down
Loading