https://github.com/python/cpython/commit/d733b104d53e96584a6881d2772df65ad82573a0
commit: d733b104d53e96584a6881d2772df65ad82573a0
branch: main
author: Vineet Kumar <[email protected]>
committer: gpshead <[email protected]>
date: 2026-07-05T19:02:58Z
summary:
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.
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]