Skip to content

Am I misunderstanding Concatenate/ParamSpec or is this a bug in MyPy? #1286

Answered by erictraut
gandhis1 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, this is a bug in mypy. Your code has some issues with the type annotations, but even when I fix those errors, mypy still generates errors. Mypy's support for PEP 612 is pretty new, so it's not surprising that it still has some bugs.

The problem in your code becomes evident if you turn on strict type checking in pyright (i.e. add # pyright: strict anywhere in the file). You have defined two generic type aliases called PreWrapFunc and PostWrapFunc. These type aliases each take a single type argument which must be compatible with a ParamSpec type parameter. But when you use these type aliases further down in the code, you are not providing a type argument. That means a type checker will…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gandhis1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants