summaryrefslogtreecommitdiff
path: root/pylint/checkers/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/checkers/utils.py')
-rw-r--r--pylint/checkers/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py
index c76c767aa..95a0e7b7b 100644
--- a/pylint/checkers/utils.py
+++ b/pylint/checkers/utils.py
@@ -356,9 +356,10 @@ def is_defined_before(var_node: nodes.Name) -> bool:
if defnode is None:
continue
defnode_scope = defnode.scope()
- if isinstance(defnode_scope, (*COMP_NODE_TYPES, nodes.Lambda)):
+ if isinstance(
+ defnode_scope, (*COMP_NODE_TYPES, nodes.Lambda, nodes.FunctionDef)
+ ):
# Avoid the case where var_node_scope is a nested function
- # FunctionDef is a Lambda until https://github.com/pylint-dev/astroid/issues/291
if isinstance(defnode_scope, nodes.FunctionDef):
var_node_scope = var_node.scope()
if var_node_scope is not defnode_scope and isinstance(