-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Refine the copy._SupportsReplace.__replace__
signature
#14786
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
Refine the copy._SupportsReplace.__replace__
signature
#14786
Conversation
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
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 not totally sure I understand what this PR fixes. Would you be able to add a test case to https://github.com/python/typeshed/blob/main/stdlib/%40tests/test_cases/check_copy.py that fails on main
?
Sure; added. |
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.
A few notes below.
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
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!
The (non-existent)*args: Any
and**kwargs: Any
can be avoided by relying on the LSP and removing them altogether, making it a bit less incorrect :)Well, I wasn't able to make it work with pyright for some reason. So the PR pivoted and now aims to add support for
__replace__
methods that replaces values associated to generic type parameters.The
ParamSpec
stuff felt to me like a more natural way of expressing this, but I'm also fine with restoring the previousAny
args and kwargs in case anyone objects.