https://github.com/python/cpython/commit/5ae62034e5ef8c9799f08364e06ade9064826e39 commit: 5ae62034e5ef8c9799f08364e06ade9064826e39 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: gpshead <[email protected]> date: 2026-07-05T19:36:51Z summary:
[3.15] gh-153141: Fix mutable default argument in _SharedMemoryTracker.__init__ (GH-153142) (#153145) 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 91bcf243e78e5b8..11c6e21de90e693 100644 --- a/Lib/multiprocessing/managers.py +++ b/Lib/multiprocessing/managers.py @@ -1294,9 +1294,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]
