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
Incompatible return type for wrappers around ParamSpec-generics #12276
When creating a helper function around a ParamSpec-based generic I recently stumbled upon a spurious "Incompatible return value type" error.
Mypy seems to (internally) represent CustomCallable[~P]-parametrized generics as CustomCallable[Callable[P, None]] instead of just CustomCallable[P]. This internal representation can be exposed in certain situations though, resulting in false positives such as in the example below.
Activity
cdce8p commentedon Mar 3, 2022
/CC: @A5rocks
A5rocks commentedon Mar 4, 2022
Yeah I wish mypy did not represent
Pas(...) -> None(I added an alternate representation for concatenate and paramspec literals :-)...This is definitely a bug that should be solved though. I'll add it to my todo list for after my current paramspec PR is merged :^)
(Unless you want to give this a try:
Callable[P, None]should be reducable toPviaCallableType.param_spec(), unless I'm misremembering the method.)Basic ParamSpec Concatenate and literal support (#11847)