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

different nested List deep clone beheviour between 1.8.2/1.9 and 1.9.1 #4169

Closed
3 tasks done
robinvd opened this issue Jun 20, 2022 · 2 comments
Closed
3 tasks done
Labels
bug V1 Bug related to Pydantic V1.X

Comments

@robinvd
Copy link

robinvd commented Jun 20, 2022

Checks

Sorry to sound so draconian, but every second saved replying to issues is time spend improving pydantic :-)

Ofc you must get a lot of issues as the maintainer of a popular package.

Bug

Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":

❯ python -c "import pydantic.utils; print(pydantic.utils.version_info())"
             pydantic version: 1.9.1
            pydantic compiled: True
                 install path: /home/robin/prog/work/linestagger/venv/lib/python3.8/site-packages/pydantic
               python version: 3.8.10 (default, Mar 15 2022, 12:22:08)  [GCC 9.4.0]
                     platform: Linux-5.13.0-44-generic-x86_64-with-glibc2.29
     optional deps. installed: ['typing-extensions']

repro:

from typing import List
from pydantic import BaseModel


class Item(BaseModel):
    names: List[str]


class Container(BaseModel):
    inner: List[Item]


item = Item(names=["a"])
cont = Container(inner=[item])

print(len(item.names), len(cont.inner[0].names))
cont.inner[0].names.append("b")
print(len(item.names), len(cont.inner[0].names))

1.8.2 and 1.9.0

1 1
2 2

1.9.1

1 1
1 2
@robinvd robinvd added the bug V1 Bug related to Pydantic V1.X label Jun 20, 2022
@hramezani
Copy link
Member

I think it got fixed on v1.9.2. Please reopen it if it's not fixed.

@robinvd
Copy link
Author

robinvd commented Aug 18, 2022

fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V1 Bug related to Pydantic V1.X
Projects
None yet
Development

No branches or pull requests

2 participants