-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix pos-only params in tkinter
module
#11506
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
Conversation
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
This comment was marked as resolved.
This comment was marked as resolved.
This is less readable. What problem does this solve? |
See conversation in #11505 (comment). I had the same initial reaction, but pyright's error is, strictly speaking, correct here. It's invalid to have a pos-only parameter following a pos-or-keyword parameter, and stubtest correctly complains about the alternative solution I thought of. |
I still don't see a practical problem being solved. Type checkers will generally tolerate small issues in stubs as long as they can understand what the stubs are trying to say. On the other hand, IDE users will not be happy trying to decipher the new |
I'd be okay reverting if we add test cases to make sure type checkers understand that it's valid at runtime to pass |
It's not. This method cannot be called so that you pass a keyword argument for
I now see that the old way to write the stub with |
Got it -- my mistake. FWIW, I did test locally, but obviously not thoroughly enough :) In that case, we should be able to simply update the signature to the much-simpler def wm_iconphoto(self, default: bool, image1: _PhotoImageLike | str, /, *args: _PhotoImageLike | str) -> None: ... |
To be honest, the whole |
Same as #11505