Skip to content

Commit e9f8969

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

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
@@ -1253,9 +1253,9 @@ class SyncManager(BaseManager):
12531253
class _SharedMemoryTracker:
12541254
"Manages one or more shared memory segments."
12551255

1256-
def __init__(self, name, segment_names=[]):
1256+
def __init__(self, name, segment_names=None):
12571257
self.shared_memory_context_name = name
1258-
self.segment_names = segment_names
1258+
self.segment_names = [] if segment_names is None else segment_names
12591259

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

0 commit comments

Comments
 (0)