Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove type checker-specific symbols from builtins.pyi and typing.pyi #7580

Open
JelleZijlstra opened this issue Apr 3, 2022 · 1 comment
Assignees
Labels
stubs: improvement Improve/refactor existing annotations, other stubs issues

Comments

@JelleZijlstra
Copy link
Member

JelleZijlstra commented Apr 3, 2022

I'm working to get rid of the type checker-specific symbols that currently are in our core stubs but don't exist at runtime. I'll use this issue to track the work needed. This involves changes both to typeshed and to type checkers.

Affected names:

  • typing._TypedDict. Suggesting to rename to _typeshed.TypedDictFallback. (mypy and pyright)
  • typing._promote -> _typeshed._promote (mypy only)
  • typing.AwaitableGenerator -> _typeshed.AwaitableGenerator (mypy and pyright)
  • builtins.function (mypy and pyright). Need to look more into why we can't just use types.FunctionType.
    • Working on this in mypy but it requires updating a ton of test cases
  • builtins.ellipsis (mypy and pyright). Should add a new name to _typeshed, similar to NoneType.

builtins.module was also mentioned in the past but it's been fixed already (mypy PR: python/mypy#3107).

Linked issues and PRs:

@JelleZijlstra JelleZijlstra self-assigned this Apr 3, 2022
@AlexWaygood
Copy link
Member

AlexWaygood commented Apr 3, 2022

contains some insight into why builtins.function and types.FunctionType used to be different.

But changes that we made to builtins.function in typeshed (to reduce false-positives) mean that they're not so different anymore, e.g.:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stubs: improvement Improve/refactor existing annotations, other stubs issues
Projects
None yet
Development

No branches or pull requests

3 participants