Repository: samuelcolvin/pydantic
Pull request #4038 (2022-05-01 21:00:49)

build(deps): bump mkdocs-material from 8.2.8 to 8.2.12
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 8.2.8 to 8.2.12.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/squidfunk/mkdocs-material/releases">mkdocs-material's releases</a>.</em></p>
<blockquote>
<h2>mkdocs-material-8.2.12</h2>
<ul>
<li>Added support for GitHub-style hash fragments for dark/light images</li>
<li>Improved rendering of nested code blocks in content tabs and annotations</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3862">#3862</a>: Upgraded to latest Pygments and Python Markdown Extensions</li>
</ul>
<h2>mkdocs-material-8.2.11</h2>
<ul>
<li>Temporarily pinned Pygments to &lt;2.12</li>
<li>Temporarily pinned Python Markdown Extensions to &lt;9.4</li>
<li>Improved rendering of code annotation markers</li>
</ul>
<h2>mkdocs-material-8.2.10</h2>
<ul>
<li>Added Macedonian translations</li>
<li>Updated Mermaid.js to version 9.0.1</li>
<li>Switched sidebar title in mobile navigation to bold font</li>
<li>Fixed color of arrows in class and state diagrams for dark mode</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3836">#3836</a>: Inline admonitions overlayed by code block titles</li>
</ul>
<h2>mkdocs-material-8.2.9</h2>
<ul>
<li>Mitigate flicker on color palette switch by disabling all transitions</li>
<li>Fixed search suggestions not triggered when following deep link</li>
<li>Fixed incorrectly computed header height when using instant loading</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3782">#3782</a>: Admonition titles have extra pixels on wide screens in Firefox</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3802">#3802</a>: Always render table of contents container (except when hidden)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG">mkdocs-material's changelog</a>.</em></p>
<blockquote>
<p>mkdocs-material-8.2.12+insiders-4.13.2 (2022-04-30)</p>
<ul>
<li>Improved caching of downloaded resources in privacy plugin</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3851">#3851</a>: External images not downloaded by privacy plugin</li>
</ul>
<p>mkdocs-material-8.2.12 (2022-04-30)</p>
<ul>
<li>Added support for GitHub-style hash fragments for dark/light images</li>
<li>Improved rendering of nested code blocks in content tabs and annotations</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3862">#3862</a>: Upgraded to latest Pygments and Python Markdown Extensions</li>
</ul>
<p>mkdocs-material-8.2.11+insiders-4.13.1 (2022-04-25)</p>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3839">#3839</a>: Tags plugin breaks without icons (4.13.0 regression)</li>
</ul>
<p>mkdocs-material-8.2.11 (2022-04-25)</p>
<ul>
<li>Temporarily pinned Pygments to &lt;2.12</li>
<li>Temporarily pinned Python Markdown Extensions to &lt;9.4</li>
<li>Improved rendering of code annotation markers</li>
</ul>
<p>mkdocs-material-8.2.10+insiders-4.13.0 (2022-04-24)</p>
<ul>
<li>Added support for tag icons</li>
</ul>
<p>mkdocs-material-8.2.10 (2022-04-24)</p>
<ul>
<li>Added Macedonian translations</li>
<li>Updated Mermaid.js to version 9.0.1</li>
<li>Switched sidebar title in mobile navigation to bold font</li>
<li>Fixed color of arrows in class and state diagrams for dark mode</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3836">#3836</a>: Inline admonitions overlayed by code block titles</li>
</ul>
<p>mkdocs-material-8.2.9 (2022-04-08)</p>
<ul>
<li>Mitigate flicker on color palette switch by disabling all transitions</li>
<li>Fixed search suggestions not triggered when following deep link</li>
<li>Fixed incorrectly computed header height when using instant loading</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3782">#3782</a>: Admonition titles have extra pixels on wide screens in Firefox</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3802">#3802</a>: Always render table of contents container (except when hidden)</li>
</ul>
<p>mkdocs-material-8.2.8+insiders-4.12.0 (2022-03-27)</p>
<ul>
<li>Added support for card grids and grid layouts</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3685">#3685</a>: Annotations sometimes broken when using instant loading</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3742">#3742</a>: Automatically add Mermaid.js when building for offline usage</li>
</ul>
<p>mkdocs-material-8.2.8 (2022-03-27)</p>
<ul>
<li>Bumped MkDocs version to 1.3.0 to mitigate breaking changes in Jinja</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/squidfunk/mkdocs-material/commit/1dd0f48ce653d1d195073e3f9383ffe1dab2ac69"><code>1dd0f48</code></a> Prepare 8.2.12 release</li>
<li><a href="https://github.com/squidfunk/mkdocs-material/commit/1eeb8b7c0ce30a2f3e1870e606be730d1fa3596a"><code>1eeb8b7</code></a> Simplified code block mounting</li>
<li><a href="https://github.com/squidfunk/mkdocs-material/commit/bdb5ba5a3dbb7ee0bc4b6e6431663f294508dacc"><code>bdb5ba5</code></a> Fixed issues with rounded borders on code blocks in some cases</li>
<li><a href="https://github.com/squidfunk/mkdocs-material/commit/f7be5c75bb99705b3f104e1921f2673b73bb0b42"><code>f7be5c7</code></a> Fixed issues related to latest Pygments and Pymdown Extensions (<a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3862">#3862</a>)</li>
<li><a href="https://github.com/squidfunk/mkdocs-material/commit/d8d734d30615c199313f5ebfbe7571e9b730e537"><code>d8d734d</code></a> Added support for GitHub-style hash fragments for dark/light images (<a href="https://github-redirect.dependabot.com/squidfunk/mkdocs-material/issues/3857">#3857</a>)</li>
<li><a href="https://github.com/squidfunk/mkdocs-material/commit/60b8ab87032c0757da3659d5b9ea0ca2f3d074b0"><code>60b8ab8</code></a> Documentation</li>
<li><a href="https://github.com/squidfunk/mkdocs-material/commit/a8cb5d0abb57969ff168af46ae6c4c7a66cfb140"><code>a8cb5d0</code></a> Documentation</li>
<li><a href="https://github.com/squidfunk/mkdocs-material/commit/990b24fc8c38168b3b783bcfd8b551deeed6c0cd"><code>990b24f</code></a> Updated Insiders changelog</li>
<li><a href="https://github.com/squidfunk/mkdocs-material/commit/8a0dc8265f98e71fc269d98f923f52742253a060"><code>8a0dc82</code></a> Updated dependencies</li>
<li><a href="https://github.com/squidfunk/mkdocs-material/commit/b8c994404750eb5cc64953a4e4eca06b839189dc"><code>b8c9944</code></a> Prepare 8.2.11 release</li>
<li>Additional commits viewable in <a href="https://github.com/squidfunk/mkdocs-material/compare/8.2.8...8.2.12">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=mkdocs-material&package-manager=pip&previous-version=8.2.8&new-version=8.2.12)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 08b22ce39..607016890 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -246,9 +246,6 @@ jobs:
       with:
         python-version: '3.10'
 
-    - name: upgrade pip
-      run: pip install -U pip setuptools wheel
-
     - name: install
       run: make install-testing
 
diff --git a/changes/3641-PrettyWood.md b/changes/3641-PrettyWood.md
new file mode 100644
index 000000000..d0338c663
--- /dev/null
+++ b/changes/3641-PrettyWood.md
@@ -0,0 +1,1 @@
+`Config.copy_on_model_validation` does a deep copy and not a shallow one
\ No newline at end of file
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 8c28433d5..da19a20fc 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -6,7 +6,7 @@ markdown-include==0.6.0
 mdx-truly-sane-lists==1.2
 mkdocs==1.3.0
 mkdocs-exclude==1.0.2
-mkdocs-material==8.2.8
+mkdocs-material==8.2.12
 sqlalchemy
 orjson
 ujson
diff --git a/pydantic/main.py b/pydantic/main.py
index eea8abcbb..1dcda9efd 100644
--- a/pydantic/main.py
+++ b/pydantic/main.py
@@ -666,7 +666,7 @@ class BaseModel(Representation, metaclass=ModelMetaclass):
     def validate(cls: Type['Model'], value: Any) -> 'Model':
         if isinstance(value, cls):
             if cls.__config__.copy_on_model_validation:
-                return value._copy_and_set_values(value.__dict__, value.__fields_set__, deep=False)
+                return value._copy_and_set_values(value.__dict__, value.__fields_set__, deep=True)
             else:
                 return value
 
diff --git a/requirements.txt b/requirements.txt
index 3beeb0fdb..71a0fbf00 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,5 +4,5 @@ Cython==0.29.28;sys_platform!='win32'
 devtools==0.8.0
 email-validator==1.1.3
 dataclasses==0.6; python_version < '3.7'
-typing-extensions==4.1.1
+typing-extensions==4.2.0
 python-dotenv==0.20.0


Test patch:
diff --git a/tests/test_main.py b/tests/test_main.py
index c00d70688..f4d3844c4 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -1561,12 +1561,28 @@ def test_model_exclude_copy_on_model_validation():
 
     assert t.user is not my_user
     assert t.user.hobbies == ['scuba diving']
-    assert t.user.hobbies is my_user.hobbies  # `Config.copy_on_model_validation` only does a shallow copy
+    assert t.user.hobbies is not my_user.hobbies  # `Config.copy_on_model_validation` does a deep copy
     assert t.user._priv == 13
     assert t.user.password.get_secret_value() == 'hashedpassword'
     assert t.dict() == {'id': '1234567890', 'user': {'id': 42, 'hobbies': ['scuba diving']}}
 
 
+def test_validation_deep_copy():
+    """By default, Config.copy_on_model_validation should do a deep copy"""
+
+    class A(BaseModel):
+        name: str
+
+    class B(BaseModel):
+        list_a: List[A]
+
+    a = A(name='a')
+    b = B(list_a=[a])
+    assert b.list_a == [A(name='a')]
+    a.name = 'b'
+    assert b.list_a == [A(name='a')]
+
+
 @pytest.mark.parametrize(
     'kinds',
     [