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
(Please feel free to re-title this as necessary if I've misunderstood the short explanation)
I believe I've found a bug that lies somewhere between a named default argument and keyword arguments that follow it, but specifically in the case where the kwargs come from a ** expanded dict.
Here is a minimal example of the function causing this:
from typing import List
def fn(x: str, y: bool=True, **kwargs: List[str]) -> None:
print(x, y, kwargs)
Here is an example of some calls to this function:
fn("hello", y=False) # ok
fn("hello", kw1=["a", "b"], kw2=["c", "d"]) # ok
...
kwargs = {"kw1": ["a", "b"], "kw2": ["c", "d"]}
fn("hello", **kwargs) # functionally same as above, but error
On the third fn call I'll end up receiving the following error when running mypy on that code:
error: Argument 2 to "fn" has incompatible type "**Dict[str, List[str]]"; expected "bool"
My general expectation was that this would work fine. This is seen while running with the following (with no special flags to the mypy run):
(Please feel free to re-title this as necessary if I've misunderstood the short explanation)
I believe I've found a bug that lies somewhere between a named default argument and keyword arguments that follow it, but specifically in the case where the kwargs come from a
**
expanded dict.Here is a minimal example of the function causing this:
Here is an example of some calls to this function:
On the third
fn
call I'll end up receiving the following error when runningmypy
on that code:My general expectation was that this would work fine. This is seen while running with the following (with no special flags to the
mypy
run):I've also tried with master (
mypy 0.650+dev.e09e72775bfeb622e67cab7d5eae0f12ef4adefa
) and the behavior is the same.The text was updated successfully, but these errors were encountered: