diff options
| author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2010-03-23 10:01:16 +0100 |
|---|---|---|
| committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2010-03-23 10:01:16 +0100 |
| commit | 9365bee1ff43b75c12b3217df25488fb419246af (patch) | |
| tree | 69d516f63b469c33e5793369ac7680b3f305cb5f /checkers/variables.py | |
| parent | 554bf4e55dee455fa5cacc6cc6ff88129e4486ea (diff) | |
| download | pylint-git-9365bee1ff43b75c12b3217df25488fb419246af.tar.gz | |
we may have name node with fromlineno to None for astng built from C-compiled modules
Diffstat (limited to 'checkers/variables.py')
| -rw-r--r-- | checkers/variables.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/checkers/variables.py b/checkers/variables.py index 31634c9c5..3293d16cc 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -327,10 +327,12 @@ builtins. Remember that you should avoid to define new builtins when possible.' """check that a name is defined if the current scope and doesn't redefine a built-in """ - name = node.name stmt = node.statement() - # probably "is_statement == True" missing somewhere in astng - assert stmt.fromlineno, (stmt, node, node.fromlineno) + if stmt.fromlineno is None: + # name node from a astng built from live code, skip + assert not stmt.root().file.endswith('.py') + return + name = node.name frame = stmt.scope() # if the name node is used as a function default argument's value or as # a decorator, then start from the parent frame of the function instead |
