Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielNoord committed Sep 19, 2022
1 parent fdb6cad commit 370ec10
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pylint/checkers/variables.py
Expand Up @@ -19,7 +19,7 @@
from typing import TYPE_CHECKING, Any, NamedTuple

import astroid
from astroid import extract_node, nodes
from astroid import bases, extract_node, nodes
from astroid.nodes import _base_nodes
from astroid.typing import InferenceResult

Expand Down Expand Up @@ -2276,7 +2276,17 @@ def _loopvar_name(self, node: astroid.Name) -> None:
inferred_return = utils.safe_infer(inferred_func.returns)
if isinstance(
inferred_return, nodes.FunctionDef
) and inferred_return.qname() in {*TYPING_NORETURN, *TYPING_NEVER}:
) and inferred_return.qname() in {
*TYPING_NORETURN,
*TYPING_NEVER,
"typing._SpecialForm",
}:
return
# typing_extensions.NoReturn returns a _SpecialForm
if (
isinstance(inferred_return, bases.Instance)
and inferred_return.qname() == "typing._SpecialForm"
):
return

maybe_walrus = utils.get_node_first_ancestor_of_type(node, nodes.NamedExpr)
Expand Down

0 comments on commit 370ec10

Please sign in to comment.