Skip to content
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

Change NoReturn to be encapsulated in strings #1252

Merged
merged 4 commits into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ What's New in astroid 2.8.6?
============================
Release date: TBA


* Fix bug on Python 3.7.0 and 3.7.1 by removing unallowed usage of ``typing.NoReturn``
DanielNoord marked this conversation as resolved.
Show resolved Hide resolved

What's New in astroid 2.8.5?
============================
Expand Down
11 changes: 6 additions & 5 deletions astroid/nodes/node_ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
if TYPE_CHECKING:
from astroid import nodes

if sys.version_info >= (3, 6, 2):
from typing import NoReturn
else:
from typing_extensions import NoReturn
if sys.version_info >= (3, 6, 2):
# To be fixed with https://github.com/PyCQA/pylint/pull/5316
from typing import NoReturn # pylint: disable=unused-import
else:
from typing_extensions import NoReturn

if sys.version_info >= (3, 8):
from typing import Literal
Expand Down Expand Up @@ -276,7 +277,7 @@ def statement(self, *, future: Literal[True]) -> "nodes.Statement":

def statement(
self, *, future: Literal[None, True] = None
) -> Union["nodes.Statement", "nodes.Module", NoReturn]:
) -> Union["nodes.Statement", "nodes.Module", "NoReturn"]:
"""The first parent node, including self, marked as statement node.

TODO: Deprecate the future parameter and only raise StatementMissing and return
Expand Down
2 changes: 1 addition & 1 deletion astroid/nodes/scoped_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def statement(self, *, future: Literal[True]) -> NoReturn:

def statement(
self, *, future: Literal[None, True] = None
) -> Union[NoReturn, "Module"]:
) -> Union["NoReturn", "Module"]:
"""The first parent node, including self, marked as statement node.

When called on a :class:`Module` with the future parameter this raises an error.
Expand Down