Skip to content

Recent change to concurrent/futures/_base.pyi broke a bunch of code #6033

Closed

Description

@erictraut

I just pulled the latest typeshed stubs for inclusion in the next release of pylance, and I noticed that a recent change to concurrent/futures/_base.pyi triggered a bunch of our internal smoke tests.

The problem is that it now imports the type Set from collections.abc rather than from typing. But collections.abc.Set is aliased to typing.AbstractSet which is not type compatible with typing.Set. Was this change intended? What is the implication of reverting it?

I've temporarily backed out this change from the copy of typeshed that we ship with pylance because I think it's going to be pretty disruptive.

Activity

  1. JelleZijlstra commented on Sep 14, 2021

    @JelleZijlstra
    Member

    cc @HunterAP23 who wrote the PR.

    It doesn't look like this change was intentional; probably it just came with switching Iterable and Mapping to being imported from collections.abc. I'd be OK with reverting this part of the PR, or just using set[] directly.

    At some point it may be helpful to set up a pyright-primer complementing mypy-primer to find issues with pyright in our CI.

  2. erictraut commented on Sep 14, 2021

    @erictraut
    ContributorAuthor

    Thanks @JelleZijlstra.

    This issue wasn't specific to pyright. Mypy would have reported the same issue if it were run on this code. We use some internal Microsoft Python code bases as a smoke test for pyright, and that's where I discovered the problem. It also triggered an error in one of pyright's unit tests, which happened to use the affected module.

  3. added a commit that references this issue on Sep 14, 2021
    4948422
  4. srittau commented on Sep 14, 2021

    @srittau
    Collaborator

    This was just an oversight. #6034.

  5. HunterAP23 commented on Sep 14, 2021

    @HunterAP23
    Contributor

    It was an oversight on my part - thank you to both srittau and akuli for correcting it.

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