Add a lint forbidding PEP-570 syntax #10660
Merged
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.
We don't want to start using PEP-570 syntax in typeshed yet, because we don't want to unnecessarily break compatibility with Python 3.7 (#10113) -- mypy users will not be able to check their code using
--python-version 3.7
after we start using PEP-570 syntax in typeshed. However, now that we no longer run mypy or stubtest in CI using Python 3.7, none of our CI fails if somebody proposes using PEP-570 syntax in a PR (e.g. #10646 (comment) wouldn't have been caught if it hadn't been for @srittau's sharp eye!).This PR proposes adding a simple lint to
check_new_syntax.py
so that we don't accidentally start using PEP-570 syntax in typeshed before we formally drop support for Python 3.7.