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
When supplying arguments by unpacking a TypedDict, and the TypedDict does not supply all the parameters, mypy seems to treat it as only supplying the first parameter, even if that is the one that is missing.
To Reproduce
from typing import TypedDict
def my_function(foo: int, bar: int) -> None:
pass
class MyTypedDict(TypedDict):
# foo: int
bar: int
a: MyTypedDict = {'bar': 1}
my_function(**a) # mypy - error: Missing positional argument "bar" in call to "my_function"
my_function(bar=1) # mypy - error: Missing positional argument "foo" in call to "my_function"
Bug Report
When supplying arguments by unpacking a TypedDict, and the TypedDict does not supply all the parameters, mypy seems to treat it as only supplying the first parameter, even if that is the one that is missing.
To Reproduce
https://mypy-play.net/?mypy=0.931&python=3.11&flags=strict&gist=c72be0814d2e7684453f2a8825f2e986
Expected Behavior
The line
my_function(**a)
should result in mypy errorerror: Missing positional argument "foo" in call to "my_function"
, as it only suppliesbar
.Actual Behavior
The line
my_function(**a)
resulted in mypy errorerror: Missing positional argument "bar" in call to "my_function"
.When executed, python gave this error:
#11753
The text was updated successfully, but these errors were encountered: