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

Support better __post_init__ method signature for dataclasses #15503

Merged
merged 7 commits into from
Jun 26, 2023

Conversation

sobolevn
Copy link
Member

Now we use a similar approach to #14849
First, we generate a private name to store in a metadata (with -, so - no conflicts, ever).
Next, we check override to be compatible: we take the currect signature and compare it to the ideal one we have.

Simple and it works :)

Closes #15498
Closes #9254

@sobolevn
Copy link
Member Author

CC @ikonst and @ilevkivskyi as recent reviewers :)

@github-actions

This comment has been minimized.

mypy/plugins/dataclasses.py Outdated Show resolved Hide resolved
mypy/checker.py Show resolved Hide resolved
test-data/unit/check-dataclasses.test Show resolved Hide resolved
test-data/unit/check-dataclasses.test Outdated Show resolved Hide resolved
@sobolevn sobolevn requested a review from ilevkivskyi June 25, 2023 10:37
@sobolevn
Copy link
Member Author

Done, all review items are now addressed. Thanks a lot for the quick feedback! 👍

@github-actions
Copy link
Contributor

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

@sobolevn sobolevn merged commit 9511daa into master Jun 26, 2023
@sobolevn sobolevn deleted the issue-15498 branch June 26, 2023 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants