Skip to content

multiprocessing.pool doesn't show as member even though it's imported #2372

Closed

Description

In python/typeshed#6111, I was going to take the suggestion of writing:

import multiprocessing.pool

class BaseContext:
    def Pool(...) -> multiprocessing.pool.Pool: ...

However, doing so complained that pool wasn't valid, even though hovering over the import (and semantic tokens in Pylance at the import) correctly understood that it was a module.

Activity

  1. erictraut commented on Oct 6, 2021

    @erictraut
    Collaborator

    I think I need more context. Can you provide a self-contained minimal repro?

  2. added
    question
    on Oct 6, 2021
  3. jakebailey commented on Oct 6, 2021

    @jakebailey
    MemberAuthor

    The main context was the file in this PR: https://github.com/python/typeshed/pull/6111/files

    I'll try to minimize it when I'm back at my desk.

  4. added
    as designed
    bug
    and removed
    question
    as designed
    on Oct 7, 2021
  5. erictraut commented on Oct 7, 2021

    @erictraut
    Collaborator

    The problem occurred because the multiprocessing module privately imported the pool submodule and didn't re-export it. Pyright therefore internally marked pool as "not externally visible". But it should have been visible because multiprocessing.pool was explicitly imported (in addition to multiprocessing).

    This will be fixed in the next release.

  6. added
    addressed in next version
    on Oct 7, 2021
  7. erictraut commented on Oct 7, 2021

    @erictraut
    Collaborator

    This is included in pyright 1.1.176, which I just published. It will also be included in the next release of pylance.

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

    addressed in next versionbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions