From 4bbee1c81d11ec1479e1fe361da34eddab5f0792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Thu, 18 Nov 2021 00:10:47 +0100 Subject: [PATCH 1/4] Change ``NoReturn`` to be encapsulated in strings --- ChangeLog | 2 +- astroid/nodes/node_ng.py | 11 ++++++----- astroid/nodes/scoped_nodes.py | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 29ba4c395d..b7b280c799 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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`` What's New in astroid 2.8.5? ============================ diff --git a/astroid/nodes/node_ng.py b/astroid/nodes/node_ng.py index 0d19dcaade..e690743477 100644 --- a/astroid/nodes/node_ng.py +++ b/astroid/nodes/node_ng.py @@ -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 @@ -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 diff --git a/astroid/nodes/scoped_nodes.py b/astroid/nodes/scoped_nodes.py index df153b8875..444e8a6511 100644 --- a/astroid/nodes/scoped_nodes.py +++ b/astroid/nodes/scoped_nodes.py @@ -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. From dca59242159b23654a44403785f9b4f8d6f3a8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Thu, 18 Nov 2021 00:29:15 +0100 Subject: [PATCH 2/4] Update ChangeLog Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b7b280c799..a6b49dc62e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,7 +12,9 @@ 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`` +* Fix bug with Python 3.7.0 / 3.7.1 and ``typing.NoReturn``. + + Closes #1239 What's New in astroid 2.8.5? ============================ From a1cc3c373adb2e211b41100f4544d7e6b0fb71a4 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Thu, 18 Nov 2021 00:31:53 +0100 Subject: [PATCH 3/4] Update ChangeLog --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a6b49dc62e..848795cc44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,7 +14,8 @@ Release date: TBA * Fix bug with Python 3.7.0 / 3.7.1 and ``typing.NoReturn``. - Closes #1239 + Closes #1239 + What's New in astroid 2.8.5? ============================ From 2b7f75505d066b7ecf03ce956c1d721586d4c4e8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 17 Nov 2021 23:32:28 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 848795cc44..db5f5ee9a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,7 +15,7 @@ Release date: TBA * Fix bug with Python 3.7.0 / 3.7.1 and ``typing.NoReturn``. Closes #1239 - + What's New in astroid 2.8.5? ============================