python / typeshed

Collection of library stubs for Python, with static types
Other
4.37k stars 1.75k forks source link

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

Open JelleZijlstra opened 2 years ago

JelleZijlstra commented 2 years ago

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:

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

Linked issues and PRs:

AlexWaygood commented 2 years ago

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.: