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
{{ message }}
Repository navigation
[Regression] Inconsistent error with ParamSpec #16058
main.py:28: error: Argument 1 to "a_func" has incompatible type "Callable[[Any, VarArg(Any)], Any]"; expected "Callable[[A, VarArg(Any), KwArg(Any)], Any]" [arg-type]
main.py:28: note: This is likely because "filter" has named arguments: "a". Consider marking them positional-only
Found 1 error in 1 file (checked 1 source file)
Your Environment
Mypy version used: mypy 1.7.0+dev.c0906408c10d24d748711fa24be5befb2c794d4c (compiled: no)
Yeah, it is really bad when switching some precise type to Any results in an error, but here it is kind of expected. There is this thing called infer_against_any (or similar), and its idea is that when we have Any actual, we should infer some very forgiving type. The problem is that inferring Any for _P creates a type that is not forgiving at all (if there is a prefix, because plain *args: Any, **kwargs: Any are special-cased). I guess this issue will be fixed by #15913 in its original form (btw could you please check if you will have time).
I am still hesitating about what to do about that PR, and @JukkaL decided to ignore me there, so I guess I will need to make the hard choice myself.
Thanks for the reply! I did check #15913 with Home Assistant (where I also noticed this error). #15913 on it's own not fix it. However, I'm also not seeing any new regressions so should be fine from that POV.
BTW feel free to ping me if I should check a PR against the whole Home Assistant test suite. I've a branch setup to test it quite easily with all it's 1300+ requirements. Might sometimes be a good addition to the regular mypy primer result.
Activity
ilevkivskyi commentedon Sep 6, 2023
Yeah, it is really bad when switching some precise type to
Anyresults in an error, but here it is kind of expected. There is this thing calledinfer_against_any(or similar), and its idea is that when we haveAnyactual, we should infer some very forgiving type. The problem is that inferringAnyfor_Pcreates a type that is not forgiving at all (if there is a prefix, because plain*args: Any, **kwargs: Anyare special-cased). I guess this issue will be fixed by #15913 in its original form (btw could you please check if you will have time).I am still hesitating about what to do about that PR, and @JukkaL decided to ignore me there, so I guess I will need to make the hard choice myself.
cdce8p commentedon Sep 7, 2023
Thanks for the reply! I did check #15913 with Home Assistant (where I also noticed this error). #15913 on it's own
notfix it. However, I'm also not seeing any new regressions so should be fine from that POV.BTW feel free to ping me if I should check a PR against the whole Home Assistant test suite. I've a branch setup to test it quite easily with all it's 1300+ requirements. Might sometimes be a good addition to the regular mypy primer result.
Lenient handling of trivial Callable suffixes (python#15913)