KEMBAR78
Fix descriptor overload selection by ilevkivskyi · Pull Request #18868 · python/mypy · GitHub
Skip to content

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
@github-actions

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.

@github-actions
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