Skip to content

Conversation

@subnix
Copy link
Contributor

@subnix subnix commented Dec 8, 2025

I've observed numerous calls to expand_callable_variants during the investigation of the related issue. However, expanding all the variants for parametrized classes can be time-consuming. Therefore, we should only expand callable variants once. This optimization reduces the processing time from approximately 400 seconds to 7 seconds when using non-compiled mypy in the provided case.

Refs: nipunn1313/mypy-protobuf#707

It may take a while to expand all the variants for parametrized classes. So we should expand other's callable variants only once.

Refs: nipunn1313/mypy-protobuf#707
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

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

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

Nice catch, thanks!

@ilevkivskyi ilevkivskyi merged commit 88cf8e0 into python:master Dec 8, 2025
23 checks passed
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.

2 participants