Skip to content

Mutable default argument in multiprocessing.dummy.DummyProcess.__init__ #138813

Closed

Description

@zeff-ir

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

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Sep 12, 2025
  2. changed the title [-]Mutable default argument in multiprocessing.dummy.DummyProcess.__init__[/-] [+]Mutable default argument in `multiprocessing.dummy.DummyProcess.__init__`[/+] on Sep 13, 2025
  3. added 2 commits that reference this issue on Sep 15, 2025
  4. added a commit that references this issue on Sep 17, 2025
  5. added 2 commits that reference this issue on Sep 17, 2025
  6. added a commit that references this issue on Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions