Skip to content

mypy complains about multiprocessing.get_context() #3564

Closed

Description

@khyox

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)

With mypy 0.520-dev with --check-untyped-defs or with --disallow-untyped-defs, I get the single message ...:8:18:error: Module has no attribute "get_context". Thanks!

Activity

  1. JelleZijlstra commented on Jun 16, 2017

    @JelleZijlstra
    Member

    This is an issue with http://github.com/python/typeshed; we're missing that function in the stubs for multiprocessing package. Feel free to open an issue at typeshed or a PR to fix the problem.

  2. ilevkivskyi commented on Jun 16, 2017

    @ilevkivskyi
    Member

    Since this is a typeshed issue, I am closing this one.
    @khyox Please open a new one at the typeshed tracker as @JelleZijlstra proposed.

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