-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treating NoneType as None and warning against using NoneType. (#13153)
### Description Fixes #11288 Warns people to not use `NoneType` as a type annotation, as requested in #11288. ### Example **Before** ```python from types import NoneType def f(x: NoneType) -> None: pass f(None) # E: Argument 1 to "f" has incompatible type "None"; expected "NoneType" ``` **After** ```python from types import NoneType def f(x: NoneType) -> None: # E: NoneType should not be used as a type, please use None instead pass f(None) ``` Had to edit `test-data/unit/lib-stub/types.pyi` to allow NoneType type annotation.
- Loading branch information
Showing
3 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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