-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed as not planned
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
For some reason, mypy
doesn't handle working with a dictionary, a lambda
function, and the get
function correctly.
To Reproduce
from typing import Callable
def test_me(my_dict: dict | None = None) -> None:
def _f(func: Callable) -> None:
func('a')
if my_dict is not None:
_f(lambda x: my_dict.get(x))
Actual Behavior
error: Item "None" of "dict[Any, Any] | None" has no attribute "get" [union-attr]
Your Environment
- Python 3.11.4
- mypy 1.5.1
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong