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: dataclass wrapper was not always called #4484
Conversation
f3644f0
to
c4a0de2
Compare
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.
LGTM, I'll fix the markdown in the change file when building history (no need for extra builds).
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.
otherwise LGTM, please update.
The fix is wrong. I'm pushing something new that handles properly inheritance and stuff (I added a new test). |
c4a0de2
to
b100e90
Compare
__post_init__
when set in dataclasses
😞 I agree, let me know when it's ready to review. |
e489ea9
to
d5fe6f8
Compare
@PrettyWood what do you think, maybe better to wait for another patch release and get the other changes released? |
d5fe6f8
to
b5c0382
Compare
@samuelcolvin it's good! Sorry I had client calls all day. Hard to do that at the same time 😓 |
I'm sure! Sorry about this. |
LGTM, thanks so much. |
I feel like |
agreed, the whole idea of the args, kwargs = schema_validator.validate_python(input)
return dc(*args, **kwargs) and never touch the dataclass. |
Yup! That's great 👍 |
Change Summary
In a stdlib dataclass without
__post_init__
,__post_init__
call is not added in the generated__init__
.So when we inherit from a stdlib dataclass and we add a
__post_init__
, it won't be called. So all its related code + validation will be ignored.Now it should be okish (not ok because it's a mess).
In v2, we should rely on stdlib dataclasses and go with a more functional approach
Related issue number
fix #4477
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details.
You can skip this check if the change does not need a change file.)