diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2021-11-18 09:27:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 09:27:14 +0100 |
commit | 3e27d87ad2323b1f863b2fb4e52e9ac2b9ff31cf (patch) | |
tree | ec9774a1c698e340cb281fb7d0c086371fd0251c | |
parent | fdc663eef855b06c78fbd15680bc050a12883d4a (diff) | |
download | astroid-git-3e27d87ad2323b1f863b2fb4e52e9ac2b9ff31cf.tar.gz |
Change ``NoReturn`` to be encapsulated in strings (#1252)
* Change ``NoReturn`` to be encapsulated in strings
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | astroid/nodes/node_ng.py | 11 | ||||
-rw-r--r-- | astroid/nodes/scoped_nodes.py | 2 |
3 files changed, 10 insertions, 6 deletions
@@ -12,6 +12,9 @@ What's New in astroid 2.8.6? ============================ 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? diff --git a/astroid/nodes/node_ng.py b/astroid/nodes/node_ng.py index 0d19dcaa..e6907434 100644 --- a/astroid/nodes/node_ng.py +++ b/astroid/nodes/node_ng.py @@ -32,10 +32,11 @@ from astroid.nodes.const import OP_PRECEDENCE 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 @@ class NodeNG: 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 df153b88..444e8a65 100644 --- a/astroid/nodes/scoped_nodes.py +++ b/astroid/nodes/scoped_nodes.py @@ -662,7 +662,7 @@ class Module(LocalsDictNodeNG): 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. |