quick fix: use %s rather than %s will avoid crash if lineno is None. See https://bitbucket.org/logilab/pylint/pull-request/6/fixed-a-bug-in-clobber_in_except-causing

authorSylvain Thénault <sylvain.thenault@logilab.fr>
changeset18a43f3b1962
branchdefault
phasepublic
hiddenno
parent revision#720a5ebaba7d string check: don't warn about octal escape sequence, warn about \o (not octal in python). Closes #111799
child revision#1de0c6ed5be4 use .fromlineno instead of .lineno (which is not reliable)
files modified by this revision
checkers/utils.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1361789457 -3600
# Mon Feb 25 11:50:57 2013 +0100
# Node ID 18a43f3b196245da2f886f6f343d1b480eede5b6
# Parent 720a5ebaba7d8c0762c99ef34b835a29f78c8ca6
quick fix: use %s rather than %s will avoid crash if lineno is None. See https://bitbucket.org/logilab/pylint/pull-request/6/fixed-a-bug-in-clobber_in_except-causing

diff --git a/checkers/utils.py b/checkers/utils.py
@@ -63,11 +63,11 @@
1          else:
2              scope, stmts = node.lookup(name)
3              if (stmts and
4                  not isinstance(stmts[0].ass_type(),
5                                 (astng.Assign, astng.AugAssign, astng.ExceptHandler))):
6 -                return (True, (name, 'outer scope (line %i)' % (stmts[0].lineno,)))
7 +                return (True, (name, 'outer scope (line %s)' % (stmts[0].lineno,)))
8      return (False, None)
9 
10 
11  def safe_infer(node):
12      """return the inferred value for the given node.