From 5475e4f7686a5b3ad26314ea65a08910d3f04dff Mon Sep 17 00:00:00 2001 From: Romuald Brunet Date: Tue, 3 Feb 2026 15:52:08 +0100 Subject: [PATCH] gh-144433: clarify patch.dict behavior Update wording to indicate that unittest.mock patch.dict will make a shallow copy of the patched dict (opposed to a deep copy) --- Lib/unittest/mock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 34fd49bf56fbb6..fa5452f56baee6 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1847,7 +1847,7 @@ class _patch_dict(object): """ Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test, where the restored dictionary is - a copy of the dictionary as it was before the test. + a shallow copy of the dictionary as it was before the test. `in_dict` can be a dictionary or a mapping like container. If it is a mapping then it must at least support getting, setting and deleting items