-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add broken NoReturn check #5304
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d87b313
Add broken NoReturn check
cdce8p 20059c6
Fix python 3.8
cdce8p 180d664
Fix parent check
cdce8p 5edeed8
Add typing-extensions as test requirement
cdce8p 59c3f7d
Update test output
cdce8p 5300d31
Rename tests
cdce8p dfcef40
Revert "Rename tests"
cdce8p fae5618
Merge branch 'main' into feat_broken-noreturn
Pierre-Sassoulas a094251
Update tests/functional/ext/typing/typing_broken_noreturn.rc
Pierre-Sassoulas 6cb012a
Merge branch 'main' into feat_broken-noreturn
Pierre-Sassoulas 0f9dae0
Merge remote-tracking branch 'upstream/main' into feat_broken-noreturn
cdce8p 17fd5ac
Fix Python 3.6
cdce8p 1ca6a85
Code review
cdce8p cc7fb08
Check for future import
cdce8p 8a6c619
Fix lineno
cdce8p b73e3f6
Update tests/functional/ext/typing/typing_broken_noreturn_future_impo…
cdce8p File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
-e . | ||
# astroid dependency is also defined in setup.cfg | ||
astroid==2.9.0 # Pinned to a specific version for tests | ||
typing-extensions>=3.10 | ||
pytest~=6.2 | ||
pytest-benchmark~=3.4 | ||
gitpython>3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
'typing.NoReturn' is broken inside compond types for Python 3.7.0 | ||
https://bugs.python.org/issue34921 | ||
|
||
If no runtime introspection is required, use string annotations instead. | ||
""" | ||
# pylint: disable=missing-docstring | ||
import sys | ||
import typing | ||
from typing import Callable, Union | ||
|
||
import typing_extensions | ||
|
||
if sys.version_info >= (3, 6, 2): | ||
DanielNoord marked this conversation as resolved.
Show resolved
Hide resolved
|
||
from typing import NoReturn | ||
else: | ||
from typing_extensions import NoReturn | ||
|
||
|
||
def func1() -> NoReturn: | ||
raise Exception | ||
|
||
def func2() -> Union[None, NoReturn]: # [broken-noreturn] | ||
pass | ||
|
||
def func3() -> Union[None, "NoReturn"]: | ||
pass | ||
|
||
def func4() -> Union[None, typing.NoReturn]: # [broken-noreturn] | ||
pass | ||
|
||
def func5() -> Union[None, typing_extensions.NoReturn]: # [broken-noreturn] | ||
pass | ||
|
||
|
||
Alias1 = NoReturn | ||
Alias2 = Callable[..., NoReturn] # [broken-noreturn] | ||
Alias3 = Callable[..., "NoReturn"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[master] | ||
py-version=3.7 | ||
load-plugins=pylint.extensions.typing | ||
|
||
[testoptions] | ||
min_pyver=3.7 | ||
DanielNoord marked this conversation as resolved.
Show resolved
Hide resolved
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
broken-noreturn:23:27:23:35:func2:'NoReturn' inside compound types is broken in 3.7.0 / 3.7.1:UNDEFINED | ||
broken-noreturn:29:27:29:42:func4:'NoReturn' inside compound types is broken in 3.7.0 / 3.7.1:UNDEFINED | ||
broken-noreturn:32:27:32:53:func5:'NoReturn' inside compound types is broken in 3.7.0 / 3.7.1:UNDEFINED | ||
broken-noreturn:37:23:37:31::'NoReturn' inside compound types is broken in 3.7.0 / 3.7.1:UNDEFINED |
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.
Uh oh!
There was an error while loading. Please reload this page.