8000 check not type in serialization by samuelcolvin · Pull Request #962 · pydantic/pydantic-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

check not type in serialization #962

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

Merged
merged 1 commit into from
Nov 6, 2023
Merged

Conversation

samuelcolvin
Copy link
Member
@samuelcolvin samuelcolvin commented Sep 12, 2023

Check values are not types when checking if they look like pydantic models or dataclasses.

fix #960

Selected Reviewer: @dmontagu

@samuelcolvin
Copy link
Member Author

please review.

@codspeed-hq
Copy link
codspeed-hq bot commented Sep 12, 2023

CodSpeed Performance Report

Merging #962 will degrade performances by 23.89%

Comparing serialization-type-check (5439c13) with main (f6b14cc)

Summary

❌ 1 regressions
✅ 137 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main serialization-type-check Change
test_dont_raise_error 30.9 µs 40.6 µs -23.89%

@samuelcolvin
Copy link
Member Author

don't merge perhaps instead of this approach we should for types separately (beforehand) and cope with them separately?

@dmontagu
Copy link
Collaborator

Makes sense, not sure which approach would be more performant

@davidhewitt
Copy link
Contributor

type is one of the builtin types where it is quick to check for subclasses just by checking a bitfield, not sure if that impacts the design.

https://github.com/python/cpython/blob/5c439fbd306b8f1dd6d14838028357098f39d013/Include/object.h#L553

@samuelcolvin samuelcolvin merged commit cb47b96 into main Nov 6, 2023
@samuelcolvin samuelcolvin deleted the serialization-type-check branch November 6, 2023 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Cannot dump model whose field value is a BaseModel subclass type
3 participants
0