summaryrefslogtreecommitdiff
path: root/checkers/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'checkers/utils.py')
-rw-r--r--checkers/utils.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/checkers/utils.py b/checkers/utils.py
index 53b40a6..728893e 100644
--- a/checkers/utils.py
+++ b/checkers/utils.py
@@ -124,7 +124,7 @@ SPECIAL_BUILTINS = ('__builtins__',) # '__path__', '__file__')
def is_builtin_object(node):
"""Returns True if the given node is an object from the __builtin__ module."""
- return node and node.root().name == '__builtin__'
+ return node and node.root().name == BUILTINS_NAME
def is_builtin(name): # was is_native_builtin
"""return true if <name> could be considered as a builtin defined by python
@@ -154,8 +154,10 @@ def is_defined_before(var_node):
elif isinstance(_node, astroid.With):
for expr, vars in _node.items:
if expr.parent_of(var_node):
- break
- if vars and vars.name == varname:
+ break
+ if (vars and
+ isinstance(vars, astroid.AssName) and
+ vars.name == varname):
return True
elif isinstance(_node, (astroid.Lambda, astroid.Function)):
if _node.args.is_argument(varname):