Skip to content
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

Fix bug with mypy plugin's handling of covariant typevar fields #9606

Merged

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Jun 7, 2024

Closes #9580 and #9581.

As noted elsewhere (including in comments in the code affected by this PR), I am not confident this is the best way to fix this bug, and I think it's suspicious that dataclasses doesn't have this issue since the pydantic mypy plugin is based on the dataclasses plugin. But I think it makes sense to just merge this and look into it more carefully/thoroughly if we continue to run into issues with typevars and/or typechecking of generic basemodels.

@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Jun 7, 2024
@dmontagu dmontagu requested a review from sydney-runkle June 7, 2024 17:14
Copy link

codspeed-hq bot commented Jun 7, 2024

CodSpeed Performance Report

Merging #9606 will not alter performance

Comparing dmontagu/fix-mypy-plugin-for-covariant-typevar-field (e537e61) with main (4dfde6f)

Summary

✅ 13 untouched benchmarks

Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

@dmontagu,

Thanks for such a quick turnaround on this. Great work!

@sydney-runkle sydney-runkle merged commit 8333bd5 into main Jun 7, 2024
54 checks passed
@sydney-runkle sydney-runkle deleted the dmontagu/fix-mypy-plugin-for-covariant-typevar-field branch June 7, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes-fix Used for bugfixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mypy plugin reports unsafe variance error on frozen models
2 participants