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
[pre-commit.ci] auto fixes from pre-commit.com hooks
  • Loading branch information
pre-commit-ci[bot] committed Jun 9, 2024
commit ce033bd598c999547542c73c682e02c80e4fbfa4
6 changes: 1 addition & 5 deletions mypy/typeanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2340,11 +2340,7 @@ def make_optional_type(t: Type) -> Type:
return t
elif isinstance(t, ProperType) and isinstance(t, UnionType):
# Eagerly expanding aliases is not safe during semantic analysis.
items = [
item
for item in t.items
if not isinstance(get_proper_type(item), NoneType)
]
items = [item for item in t.items if not isinstance(get_proper_type(item), NoneType)]
return UnionType(items + [NoneType()], t.line, t.column)
else:
return UnionType([t, NoneType()], t.line, t.column)
Expand Down