Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy confused by omitted optional argument before kwargs #2990

Closed
jeffkaufman opened this issue Mar 13, 2017 · 2 comments
Closed

mypy confused by omitted optional argument before kwargs #2990

jeffkaufman opened this issue Mar 13, 2017 · 2 comments

Comments

@jeffkaufman
Copy link

jeffkaufman commented Mar 13, 2017

When I give mypy:

def foo(bar: bool = False, **kwargs: str) -> None:
    print('foo(bar=%s, **kwargs=%s)' % (bar, kwargs))

foo(**{'a': 'a', 'b': 'b'})

I get:

4: error: Argument 1 to "foo" has incompatible type **Dict[str, str]; expected "bool"

On the other hand, these work fine:

foo(a='a', b='b')
foo(a='a', b='b', bar=True)

Running the code, python has no objection to it:

$ python ~/tmp.py
foo(bar=False, **kwargs={'a': 'a', 'b': 'b'})

This is with:

$ python --version
Python 3.6.0
$ mypy --version
mypy 0.470```
@gvanrossum
Copy link
Member

I believe this is a duplicate of #1969. @jeffkaufman If you agree can you please close your own issue?

@jeffkaufman
Copy link
Author

Thanks, that does look the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants