-
Notifications
You must be signed in to change notification settings - Fork 313
Fix condition before using prebuilt validator/serializer #1625
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
CodSpeed Performance ReportMerging #1625 will not alter performanceComparing Summary
|
src/common/prebuilt.rs
Outdated
| // However, we don't want to use a prebuilt structure from dataclasses if we have a `generic_origin` | ||
| // as this means the dataclass was parametrized (so a generic alias instance), and `cls` in the | ||
| // core schema is still the (unparametrized) class, meaning we would fetch the wrong validator/serializer. | ||
| if (type_ != "model") || (type_ == "dataclass" && schema.contains(intern!(py, "generic_origin"))?) { |
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.
type_ != "model" will always be True for type == "dataclass", so I think the new boolean logic here is wrong?
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.
Indeed, seems like it is wrong on main as well, I'll fix it
'typed-dict' schemas for prebuilt validator/serializer…dantic-core#1625) Typed dictionaries don't have cached validators/serializers, and the condition wasn't actually ignoring parametrized dataclasses. Original-commit-hash: 9446588
…dantic-core#1625) Typed dictionaries don't have cached validators/serializers, and the condition wasn't actually ignoring parametrized dataclasses. Original-commit-link: pydantic/pydantic-core@9446588
Change Summary
Follow up on #1616.
Related issue number
Checklist
pydantic-core(except for expected changes)