Skip to content

Missing stub for multiprocessing.get_context() #1422

Closed

Description

@khyox

Following suggestion in mypy #3564.

Repro:

import multiprocessing
import os

METHODS = ['spawn', 'fork', 'forkserver']

if __name__ == '__main__':
    for method in METHODS:
        context = multiprocessing.get_context(method)
        with context.Pool(processes=4) as pool:
            results = [pool.apply_async(os.getpid, ()) for i in range(4)]
            print([res.get(timeout=1) for res in results], method)

mypy with --check-untyped-defs or with --disallow-untyped-defs complains with the single message ...:8:18:error: Module has no attribute "get_context".

Activity

  1. gvanrossum commented on Jun 21, 2017

    @gvanrossum
    Member

    Thanks for the report -- do you think you will be able to contribute a Pull Request to fix this?

  2. khyox commented on Jun 21, 2017

    @khyox
    ContributorAuthor

    Thanks for the opportunity! If it is not urgent to close this issue, then I can try, otherwise, please, feel free to fix it.

  3. added a commit that references this issue on Jun 25, 2017
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions