-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
The parameters used in a call to a function which is wrapped in a functools.lru_cache
are not checked.
To Reproduce
from datetime import date
from functools import lru_cache
@lru_cache
def f(v: str, at: date) -> str:
return v
f()
f("abc")
f("abc", date.today())
f("abc", now=date.today())
f("abc", at=date.today())
f("abc", at="wrong_type")
Expected Behavior
This should raise several errors about the arguments being wrong. Commenting out the line @lru_cache
correctly generates the following errors.
lru_cache_type_test.py:8: error: Missing positional arguments "v", "at" in call to "f" [call-arg]
lru_cache_type_test.py:9: error: Missing positional argument "at" in call to "f" [call-arg]
lru_cache_type_test.py:11: error: Unexpected keyword argument "now" for "f" [call-arg]
lru_cache_type_test.py:13: error: Argument "at" to "f" has incompatible type "str"; expected "date" [arg-type]
Actual Behavior
Success: no issues found in 1 source file
Your Environment
mypy 1.6.0 running on Python 3.11.6
Hnasar
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong