summaryrefslogtreecommitdiff
path: root/checkers/utils.py
diff options
context:
space:
mode:
authorEmile Anclin <emile.anclin@logilab.fr>2010-04-15 16:19:57 +0200
committerEmile Anclin <emile.anclin@logilab.fr>2010-04-15 16:19:57 +0200
commit73334c2f3cc82c037d25d4a1925bc186c057971d (patch)
tree85b9cfdaf184fee50040565d18359b10f1e72647 /checkers/utils.py
parent21093b15a04d9c48dbbde8583d17d185d6245be9 (diff)
downloadpylint-73334c2f3cc82c037d25d4a1925bc186c057971d.tar.gz
fix #20067: pylint crash with AttributeError
in a with statement without 'as', node.vars is None
Diffstat (limited to 'checkers/utils.py')
-rw-r--r--checkers/utils.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/checkers/utils.py b/checkers/utils.py
index 92ff272..740df6a 100644
--- a/checkers/utils.py
+++ b/checkers/utils.py
@@ -99,6 +99,9 @@ def is_defined_before(var_node, comp_node_types=COMP_NODE_TYPES):
if ass_node.name == varname:
return True
elif isinstance(_node, astng.With):
+ if _node.vars is None:
+ # quickfix : case in which 'with' is used without 'as'
+ return False
if _node.vars.name == varname:
return True
elif isinstance(_node, (astng.Lambda, astng.Function)):