-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
The DummyProcess.__init__ method in multiprocessing.dummy uses a mutable default argument for kwargs:
def __init__(self, group=None, target=None, name=None, args=(), kwargs={}):This can lead to unexpected behavior if the same dictionary is modified between calls.
Other threading-based classes like threading.Thread and threading.Timer already use None as the default and initialize a new dict inside the constructor.
CPython versions tested on:
CPython main branch, 3.13, 3.14, 3.15
Operating systems tested on:
Linux
Linked PRs
- gh-138813: Fix mutable default kwargs={} in multiprocessing BaseProcess and DummyProcess to use None #138814
- [3.13] gh-138813: Fix mutable default kwargs={} in multiprocessing BaseProcess and DummyProcess to use None (GH-138814) #139083
- [3.14] gh-138813: Fix mutable default kwargs={} in multiprocessing BaseProcess and DummyProcess to use None (GH-138814) #139084
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error