Skip to content

Commit 5ae6203

Browse files
[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 d733b10) Co-authored-by: Vineet Kumar <108144301+whyvineet@users.noreply.github.com>
1 parent 986322e commit 5ae6203

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/multiprocessing/managers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,9 +1294,9 @@ class SyncManager(BaseManager):
12941294
class _SharedMemoryTracker:
12951295
"Manages one or more shared memory segments."
12961296

1297-
def __init__(self, name, segment_names=[]):
1297+
def __init__(self, name, segment_names=None):
12981298
self.shared_memory_context_name = name
1299-
self.segment_names = segment_names
1299+
self.segment_names = [] if segment_names is None else segment_names
13001300

13011301
def register_segment(self, segment_name):
13021302
"Adds the supplied shared memory block name to tracker."

0 commit comments

Comments
 (0)