Skip to content

Conversation

@davidhewitt
Copy link
Contributor

Change Summary

This PR changes the serialization code paths to pass &mut SerializationState around, similar to the validation code path.

At the moment this is a large-ish +ve diff. I will follow it up with changes to move include / exclude / extra into the state, which will reduce code size and complexity overall.

Please forgive me, I'm going to just proceed to merge this so I can move forward with the refactoring. The changes here are all mechanical internal refactoring.

Related issue number

N/A

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@davidhewitt davidhewitt enabled auto-merge (squash) October 24, 2025 20:12
@davidhewitt davidhewitt merged commit 9822977 into main Oct 24, 2025
31 checks passed
@davidhewitt davidhewitt deleted the dh/ser-state-warnings branch October 24, 2025 20:20
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 24, 2025

CodSpeed Performance Report

Merging #1857 will improve performances by 13.25%

Comparing dh/ser-state-warnings (3a29497) with main (eed392b)

Summary

⚡ 2 improvements
✅ 161 untouched

Benchmarks breakdown

Benchmark BASE HEAD Change
test_json_any_list_int 228.7 µs 207.8 µs +10.05%
test_to_json_list_of_lists 2.1 ms 1.8 ms +13.25%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants