-
-
Notifications
You must be signed in to change notification settings - Fork 3k
[stubtest] Check runtime availability of private types not marked @type_check_only
#19574
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
Draft
brianschubert
wants to merge
1
commit into
python:master
Choose a base branch
from
brianschubert:stubtest-private-typecheckonly
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
[stubtest] Check runtime availability of private types not marked @type_check_only
#19574
brianschubert
wants to merge
1
commit into
python:master
from
brianschubert:stubtest-private-typecheckonly
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python/typeshed#14512 addresses the new stdlib hits in typeshed thirdy-party stub hits can be seen at https://github.com/brianschubert/typeshed/actions/runs/16697076815/ |
These are the third-party stub hits if anyone is interested in investigating some (I'll be sifting through them as I have time)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, stubtest ignores symbols that are 1) private and 2) not present at runtime. Private names are often used for stub-only constructs (which we don't want stubtest to complain about), but they can also denote actual private runtime types. Without other context, it's often ambiguous which category a private names falls into. For class definitions, we can make the intent explicit by decorating the class with
@type_check_only
. Typeshed already does this for the most part, but there's still quite a few cases of stub-only private types that aren't marked@type_check_only
(especially in older stubs).Going forward, I think it could a good idea to make stubtest start checking for
@type_check_only
on private types that are not available at runtime.A few special cases are needed to avoid false positives on types that cannot be marked with
@type_check_only
, namely:This PR creates quite a few new errors on typeshed (~100 in stdlib, ~300 in third-party stubs), which we'll probably want to sift through before merging this. So far I've gone through the stdlib hits, all of which seem to be true positives that we'd want to update.