Skip to content

Conversation

davidhewitt
Copy link
Contributor

Change Summary

Followup to #1623

This vastly extends the tests, to cover dataclass and TypedDict as well as model, and also checks that these things behave properly in a union.

For now I keep the state around, but I think in principle we could make these container types default-aware, make them the only place to legally set a default factory which takes data, and remove the state.

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 requested a review from Viicos October 6, 2025 16:34
@davidhewitt davidhewitt force-pushed the dh/fix-default-factory-error branch from bc59bd9 to c67199a Compare October 6, 2025 16:35
Copy link

codspeed-hq bot commented Oct 6, 2025

CodSpeed Performance Report

Merging #1822 will not alter performance

Comparing dh/fix-default-factory-error (c67199a) with main (e87ba01)

Summary

✅ 163 untouched

Copy link
Member

@Viicos Viicos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally with the example given on Slack, works as expected 👍

@davidhewitt davidhewitt merged commit b45d087 into main Oct 6, 2025
31 of 32 checks passed
@davidhewitt davidhewitt deleted the dh/fix-default-factory-error branch October 6, 2025 17:48
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