Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Mypy micro-optimizations (batch 1/3)#19768
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
According tomypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
87f4dc8 intomasterUh oh!
There was an error while loading.Please reload this page.
| self.variables=variables | ||
| self.variables:tuple[TypeVarLikeType, ...] | ||
| ifvariablesisNone: | ||
| self.variables= () | ||
| else: | ||
| self.variables=tuple(variables) |
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.
Note, this does crash thepydantic.v1 extension.
File"/.../python3.13/site-packages/pydantic/v1/mypy.py",line868,inadd_methodsignature.variables= [tvar_def]^^^^^^^^^^^^^^^^^^^TypeError:tupleobjectexpected;gotlist
https://github.com/pydantic/pydantic/blob/v2.11.7/pydantic/v1/mypy.py#L866-L868
It can fairly easily be fixed and I'll open a PR for it soon. However, that might not be the only plugin which depends on it being "just" a sequence.
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.
If we have evidence that this impacts multiple plugins, we can consider reverting this change.
Uh oh!
There was an error while loading.Please reload this page.
Several mypy micro-optimizations. Together with batches 2 and 3 these improve self check performance by 1.8%.