Skip to content
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

Fix misbehavior related to copying of RootModel #6918

Merged
merged 1 commit into from Jul 28, 2023
Merged

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Jul 27, 2023

Closes #6911

Technically we could include a check in the __copy__ directly in BaseModel, but I think this is just a bit more performant since it removes the if not self.__pydantic_root_model__: branch in the method for both classes.

Can refactor to modify the BaseModel methods if preferred.

Selected Reviewer: @hramezani

@cloudflare-pages
Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 69ef769
Status: ✅  Deploy successful!
Preview URL: https://a2cd2f4c.pydantic-docs2.pages.dev
Branch Preview URL: https://fix-rootmodel-copy.pydantic-docs2.pages.dev

View logs

@dmontagu
Copy link
Contributor Author

please review

@dmontagu dmontagu merged commit 4de8fa4 into main Jul 28, 2023
49 checks passed
@dmontagu dmontagu deleted the fix-rootmodel-copy branch July 28, 2023 13:09
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.

A model field with contents identical to a created object are not equal if a custom type (rootmodel) is used
2 participants