-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
mypy reports a arg-type
error Argument 2 to "send_command" has incompatible type "**Dict[str, object]"; expected "Optional[float]" [arg-type]
for a valid function invocation.
To Reproduce
def send_command(name: str, *, timeout: Optional[float] = None, **params: Any):
print(name, params, timeout)
send_command("Test", **{"p1": "abc"})
Expected Behavior
The code above should typecheck without any error.
Actual Behavior
I get the following mypy error:
main.py:7: error: Argument 2 to "send_command" has incompatible type "**Dict[str, str]"; expected "Optional[float]" [arg-type]
Your Environment
- Mypy version used: 1.3.0
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini
(and other config files): None - Python version used: 3.11
See also
- This python/typing discussion: Correct typing for function taking keyword-only arguments and kwargs typing#1406
- Maybe related: Odd error message when kwargs passed as **dict #5382
tonkolviktor, deadnews, 153957, MetRonnie, gubenkoved and 5 more
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong