-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
After the latest sync from typeshed (commit 4996d57, PR #11600), this valid code is highlighted as error by mypy:
def foo(vars: dict[str, str]):
val = vars.get("fqdn", default=None)
reveal_type(val)Result before:
_local/dictget.py:3: note: Revealed type is "Union[builtins.str, None]"
Result after:
_local/dictget.py:2: error: No overload variant of "get" of "Mapping" matches argument types "str", "None"
_local/dictget.py:2: note: Possible overload variants:
_local/dictget.py:2: note: def get(self, key: str) -> Optional[str]
_local/dictget.py:2: note: def [_T] get(self, str, Union[str, _T]) -> Union[str, _T]
_local/dictget.py:3: note: Revealed type is "Any"
Your Environment
- Mypy version used: mypy 0.920+dev.4996d571272adde83a3de2689c0147ca1be23f2c
- Mypy command-line flags: (none)
- Mypy configuration options from
mypy.ini(and other config files): (none) - Python version used: 3.10.0
- Operating system and version: macOS
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong