diff options
author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2013-02-25 12:00:10 +0100 |
---|---|---|
committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2013-02-25 12:00:10 +0100 |
commit | 37b07b305fb190df034b2810d47e194938fc26ce (patch) | |
tree | 47261a9f1eae0512b4b45c4d4a9ee1553c23e914 | |
parent | 2e57298846aeb72b589329f63af434bf9d74f398 (diff) | |
download | pylint-git-37b07b305fb190df034b2810d47e194938fc26ce.tar.gz |
use .fromlineno instead of .lineno (which is not reliable)
-rw-r--r-- | checkers/imports.py | 2 | ||||
-rw-r--r-- | checkers/utils.py | 4 | ||||
-rw-r--r-- | checkers/variables.py | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/checkers/imports.py b/checkers/imports.py index 455df941b..9944a585f 100644 --- a/checkers/imports.py +++ b/checkers/imports.py @@ -36,7 +36,7 @@ def get_first_import(node, context, name, base, level): for first in context.body: if first is node: continue - if first.scope() is node.scope() and first.lineno > node.lineno: + if first.scope() is node.scope() and first.fromlineno > node.fromlineno: continue if isinstance(first, astng.Import): if any(fullname == iname[0] for iname in first.names): diff --git a/checkers/utils.py b/checkers/utils.py index 2115b5149..aa4563ee4 100644 --- a/checkers/utils.py +++ b/checkers/utils.py @@ -1,6 +1,6 @@ # pylint: disable=W0611 # -# Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE). +# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This program is free software; you can redistribute it and/or modify it under @@ -65,7 +65,7 @@ def clobber_in_except(node): if (stmts and not isinstance(stmts[0].ass_type(), (astng.Assign, astng.AugAssign, astng.ExceptHandler))): - return (True, (name, 'outer scope (line %s)' % (stmts[0].lineno,))) + return (True, (name, 'outer scope (line %s)' % (stmts[0].fromlineno,))) return (False, None) diff --git a/checkers/variables.py b/checkers/variables.py index cf5d9f7b4..ff9a1d954 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -1,4 +1,4 @@ -# Copyright (c) 2003-2012 LOGILAB S.A. (Paris, FRANCE). +# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This program is free software; you can redistribute it and/or modify it under @@ -272,7 +272,7 @@ builtins. Remember that you should avoid to define new builtins when possible.' if is_inside_except(stmt): continue if name in globs and not isinstance(stmt, astng.Global): - line = globs[name][0].lineno + line = globs[name][0].fromlineno self.add_message('W0621', args=(name, line), node=stmt) elif is_builtin(name): # do not print Redefining builtin for additional builtins |