Skip to content

Conversation

jorenham
Copy link
Contributor

@jorenham jorenham commented Sep 26, 2025

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 previous Any args and kwargs in case anyone objects.

This comment has been minimized.

@jorenham

This comment was marked as outdated.

This comment has been minimized.

Copy link
Member

@AlexWaygood AlexWaygood left a 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?

@jorenham
Copy link
Contributor Author

Thanks! I'm not totally sure I understand what this PR fixes. Would you be able to add a test case to main/stdlib/%40tests/test_cases/check_copy.py that fails on main?

Sure; added.

This comment has been minimized.

Copy link
Collaborator

@srittau srittau left a 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.

jorenham and others added 3 commits September 30, 2025 19:55
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@srittau srittau merged commit 91055c7 into python:main Sep 30, 2025
63 checks passed
@jorenham jorenham deleted the copy._SupportsReplace.__replace__ branch September 30, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants