From 2a5fb36d43226b574d1c8237c52ebab958bc91e7 Mon Sep 17 00:00:00 2001 From: Randolf Scholz Date: Mon, 16 Jun 2025 18:04:19 +0200 Subject: [PATCH 1/3] update .items() in collections.abc --- Lib/_collections_abc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py index 51263d696a1777..ad2f01b9653603 100644 --- a/Lib/_collections_abc.py +++ b/Lib/_collections_abc.py @@ -967,8 +967,8 @@ def update(self, other=(), /, **kwds): In either case, this is followed by: for k, v in F.items(): D[k] = v ''' if isinstance(other, Mapping): - for key in other: - self[key] = other[key] + for key, value in other.items(): + self[key] = value elif hasattr(other, "keys"): for key in other.keys(): self[key] = other[key] From d6f4c823eaaa30642984f3a30e02f26c00112f23 Mon Sep 17 00:00:00 2001 From: Randolf Scholz Date: Mon, 16 Jun 2025 18:16:55 +0200 Subject: [PATCH 2/3] added blurb --- .../2025-06-16-18-16-41.gh-issue-135575._N5rTH.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2025-06-16-18-16-41.gh-issue-135575._N5rTH.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-06-16-18-16-41.gh-issue-135575._N5rTH.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-06-16-18-16-41.gh-issue-135575._N5rTH.rst new file mode 100644 index 00000000000000..c4b6d561c1aef7 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-06-16-18-16-41.gh-issue-135575._N5rTH.rst @@ -0,0 +1 @@ +Improved performance of ``MutableMapping.update``. From d0aaa86d5ae8fd1336f7cbce170a57be74ada2d5 Mon Sep 17 00:00:00 2001 From: Randolf Scholz Date: Tue, 17 Jun 2025 00:17:11 +0200 Subject: [PATCH 3/3] Update 2025-06-16-18-16-41.gh-issue-135575._N5rTH.rst --- .../2025-06-16-18-16-41.gh-issue-135575._N5rTH.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-06-16-18-16-41.gh-issue-135575._N5rTH.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-06-16-18-16-41.gh-issue-135575._N5rTH.rst index c4b6d561c1aef7..5b5bef87bd4949 100644 --- a/Misc/NEWS.d/next/Core_and_Builtins/2025-06-16-18-16-41.gh-issue-135575._N5rTH.rst +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-06-16-18-16-41.gh-issue-135575._N5rTH.rst @@ -1 +1 @@ -Improved performance of ``MutableMapping.update``. +Improved performance of :meth:`collections.abc.MutableMapping.update`.