https://github.com/python/cpython/commit/e9f8969cf2fba0eb208bde49990d07b91bacc0f6
commit: e9f8969cf2fba0eb208bde49990d07b91bacc0f6
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: gpshead <[email protected]>
date: 2026-07-05T12:36:15-07:00
summary:

[3.13] gh-153141: Fix mutable default argument in _SharedMemoryTracker.__init__ 
(GH-153142) (#153147)

gh-153141: Fix mutable default argument in _SharedMemoryTracker.__init__ 
(GH-153142)

Fix default argument for segment_names in _SharedMemoryTracker constructor to 
not use a mutable list.
(cherry picked from commit d733b104d53e96584a6881d2772df65ad82573a0)

Co-authored-by: Vineet Kumar <[email protected]>

files:
M Lib/multiprocessing/managers.py

diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py
index ef791c2751688a7..d145304300358e1 100644
--- a/Lib/multiprocessing/managers.py
+++ b/Lib/multiprocessing/managers.py
@@ -1253,9 +1253,9 @@ class SyncManager(BaseManager):
     class _SharedMemoryTracker:
         "Manages one or more shared memory segments."
 
-        def __init__(self, name, segment_names=[]):
+        def __init__(self, name, segment_names=None):
             self.shared_memory_context_name = name
-            self.segment_names = segment_names
+            self.segment_names = [] if segment_names is None else segment_names
 
         def register_segment(self, segment_name):
             "Adds the supplied shared memory block name to tracker."

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to