-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Use identity instead of equality after validating model in __init__
#10264
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
Conversation
Deploying pydantic-docs with
|
| Latest commit: |
da25e53
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1fbd0bb5.pydantic-docs.pages.dev |
| Branch Preview URL: | https://init-fix.pydantic-docs.pages.dev |
CodSpeed Performance ReportMerging #10264 will improve performances by 36.56%Comparing Summary
Benchmarks breakdown
|
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.
Change looks good, thanks
tests/test_validators.py
Outdated
| return Child.model_construct(name='different!') | ||
| return Child.model_construct(name='name') | ||
|
|
||
| with pytest.warns(UserWarning, match='A custom validator is returning a value other than `self`'): | ||
| Child(name='foo') | ||
| Child(name='name') |
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.
I'd rather leave these as different to illustrate the odd behavior...
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.
To make it more clear, we could add an assert and a comment at the end (like self overrides, blah blah blah)
|
Great work on the perf boost here. |
a68dc6a to
97f51c2
Compare
…pydantic#10264) Co-authored-by: sydney-runkle <sydneymarierunkle@gmail.com>
Change Summary
Follow up on #10255.
This is more accurate and avoids the big performant hit.
Checklist