You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unpacking a dict when calling a function with **kwargs should not fail. This seems to be related to #4771 and #9676, but slightly different since the function definition is wider than those reports.
test.py:13: note: Revealed type is 'def (one: Union[builtins.int, None] =, **kwargs: Any) -> Union[builtins.int, None]'
test.py:14: note: Revealed type is 'Union[builtins.int, None]'
test.py:15: note: Revealed type is 'Union[builtins.int, None]'
test.py:16: error: Argument 1 to "test" has incompatible type "**Dict[str, str]"; expected "Optional[int]" [arg-type]
Expected Behavior
There is no issue passing kwargs via a dict and you shouldn't need to cast to a Mapping type.
Actual Behavior
There is an error message, but reveal_type(test(**cast(Mapping[str, str], {'test': 'one'}))) (or saving as a temporary variable with Mapping as its type) will allow the code to succeed.
Your Environment
Mypy version used: 0.800
Mypy command-line flags: --show-error-codes
Mypy configuration options from mypy.ini (and other config files):
Python version used: 3.8
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
Unpacking a
dict
when calling a function with **kwargs should not fail. This seems to be related to #4771 and #9676, but slightly different since the function definition is wider than those reports.To Reproduce
which outputs:
Expected Behavior
There is no issue passing kwargs via a
dict
and you shouldn't need to cast to aMapping
type.Actual Behavior
There is an error message, but
reveal_type(test(**cast(Mapping[str, str], {'test': 'one'})))
(or saving as a temporary variable withMapping
as its type) will allow the code to succeed.Your Environment
--show-error-codes
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: