Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Open
Description
https://mypy-play.net/?mypy=master&python=3.12&flags=verbose&gist=c3db401cf676c8c593dec1c525f7e748
Mypy Version: 1.20.0+dev.d06d3d9cfd6611c0e64c0df59fc0449754e47ed8
Fixed by:#20419
See Also:#20416
fromtypingimportLiteral,Mapping,Iterabledeffunc(a:int,b:int)->None: ...classGOOD_KW:defkeys(self)->Iterable[Literal["a","b"]]: ...def__getitem__(self,key:str)->int: ...classBAD_KW:defkeys(self)->Iterable[Literal["one",1]]: ...def__getitem__(self,key:str)->int: ...deftest(good_kw:GOOD_KW,bad_kw:BAD_KW,good_dict:dict[Literal["a","b"],int],bad_dict:dict[Literal["one",1],int],good_mapping:Mapping[Literal["a","b"],int],bad_mapping:Mapping[Literal["one",1],int],)->None:func(**good_kw)func(**bad_kw)# E: Argument after ** must have string keysfunc(**good_dict)func(**bad_dict)# E: Argument after ** must have string keysfunc(**good_mapping)# ❌️ False positivefunc(**bad_mapping)# E: Argument after ** must have string keys