File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 19
19
from typing import TYPE_CHECKING , Any , NamedTuple
20
20
21
21
import astroid
22
- from astroid import extract_node , nodes
22
+ from astroid import bases , extract_node , nodes
23
23
from astroid .nodes import _base_nodes
24
24
from astroid .typing import InferenceResult
25
25
@@ -2276,7 +2276,17 @@ def _loopvar_name(self, node: astroid.Name) -> None:
2276
2276
inferred_return = utils .safe_infer (inferred_func .returns )
2277
2277
if isinstance (
2278
2278
inferred_return , nodes .FunctionDef
2279
- ) and inferred_return .qname () in {* TYPING_NORETURN , * TYPING_NEVER }:
2279
+ ) and inferred_return .qname () in {
2280
+ * TYPING_NORETURN ,
2281
+ * TYPING_NEVER ,
2282
+ "typing._SpecialForm" ,
2283
+ }:
2284
+ return
2285
+ # typing_extensions.NoReturn returns a _SpecialForm
2286
+ if (
2287
+ isinstance (inferred_return , bases .Instance )
2288
+ and inferred_return .qname () == "typing._SpecialForm"
2289
+ ):
2280
2290
return
2281
2291
2282
2292
maybe_walrus = utils .get_node_first_ancestor_of_type (node , nodes .NamedExpr )
You can’t perform that action at this time.
0 commit comments