-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reject invalid ParamSpec locations #18278
base: master
Are you sure you want to change the base?
Reject invalid ParamSpec locations #18278
Conversation
…lysis - only bare paramspec binds.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'm glad to see several bugs fixed. Looks good!
Actually, the home-assistant error might be false positive. Can you look at it? |
Amazing. I wasn't able to reproduce the problem on a local clone, and indeed it was apparently a glitch: another primer run did not produce an error there. |
Diff from mypy_primer, showing the effect of this PR on open source code: altair (https://github.com/vega/altair)
+ altair/theme.py:250: error: ParamSpec "P" is unbound [valid-type]
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/_internal/compatibility/async_dispatch.py:77: error: Arguments not allowed after ParamSpec.args [valid-type]
+ src/prefect/flows.py:1259: error: Arguments not allowed after ParamSpec.args [valid-type]
+ src/prefect/flows.py:1268: error: Arguments not allowed after ParamSpec.args [valid-type]
+ src/prefect/flows.py:1276: error: Arguments not allowed after ParamSpec.args [valid-type]
+ src/prefect/tasks.py:970: error: Arguments not allowed after ParamSpec.args [valid-type]
+ src/prefect/tasks.py:978: error: Arguments not allowed after ParamSpec.args [valid-type]
+ src/prefect/tasks.py:1041: error: Arguments not allowed after ParamSpec.args [valid-type]
+ src/prefect/tasks.py:1050: error: Arguments not allowed after ParamSpec.args [valid-type]
pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/gdblib/events.py: note: In function "connect":
+ pwndbg/gdblib/events.py:277: error: ParamSpec "P" is unbound [valid-type]
|
Not it wasn't a glitch. I just fixed it already after seeing your PR 😉
|
Ough! I was moderately certain that I reviewed primer hits and found them to be correct, but did not expect a fix in between... Please comment next time you do that!:) |
Fixes #14832, fixes #13966, fixes #14622.
Still does not report error in #14777, I'll work separately on that.
Move all
ParamSpec
validity checking totypeanal.py
. Stop treatingP.args
andP.kwargs
as binding - only bare typevar makes it available in scope. Reject keyword arguments followingP.args
.This also makes one more conformance test pass. Diff (against baseline on current master):