Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make a shallow copy of the root type when usingmodel_copy() onRootModel #12543

Open
Labels
changeSuggested alteration to Pydantic, not a new feature nor a bugfeature request
@keriksson-rosenqvist-oqc

Description

Initial Checks

  • I confirm that I'm using Pydantic V2

Description

When attempting to copy a RootModel type the root is not copied but rather the same instance as the original. I would expect the new root to be a shallow copy of the original root.

Example Code

frompydanticimportRootModellist_1=RootModel[list[int]]([1,2,3])list_2=list_1.model_copy()assertlist_1.rootisnotlist_2.root

Python, Pydantic & OS Version

pydantic version: 2.11.7        pydantic-core version: 2.33.2          pydantic-core build: profile=release pgo=false               python version: 3.10.18 (main, Jul 28 2025, 11:42:17) [GCC 11.4.0]                     platform: Linux-6.8.0-87-generic-x86_64-with-glibc2.39             related packages: typing_extensions-4.15.0 pydantic-extra-types-2.10.6 pydantic-settings-2.11.0                       commit: unknown

Metadata

Metadata

Assignees

No one assigned

    Labels

    changeSuggested alteration to Pydantic, not a new feature nor a bugfeature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp