Skip to content

Fix descriptor overload selection #18868

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

Merged
merged 2 commits into from
Apr 2, 2025

Conversation

ilevkivskyi
Copy link
Member

Fixes #15921

I know there were previously concerns about performance of check_self_arg(), but note that the code path where I add it only affects descriptors and __getattr__/__setattr__, so I think it should be OK.

@ilevkivskyi ilevkivskyi requested a review from JukkaL April 1, 2025 12:28

This comment has been minimized.

@ilevkivskyi
Copy link
Member Author

Most of the churn are because error codes for overloaded and non-overloaded functions are different. There are couple other things (likely caused by always_covariant=True I added for erased ParamSpec generics), I will double-check later today/tomorrow.

Copy link
Contributor

github-actions bot commented Apr 1, 2025

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@ilevkivskyi
Copy link
Member Author

@JukkaL this is ready for review now.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Overloads based on self types are tricky, glad to see improvements here.

@ilevkivskyi ilevkivskyi merged commit d6cb14f into python:master Apr 2, 2025
18 checks passed
@ilevkivskyi ilevkivskyi deleted the descriptor-check-bind-self branch April 2, 2025 12:13
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.

Class __get__ method is not working for generic specialization overload cases
2 participants