diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2009-11-25 19:37:12 +0100 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2009-11-25 19:37:12 +0100 |
commit | 22cd213f120fdb6e2e8b0bed7bd2ad5618aba064 (patch) | |
tree | b4695ef78ee5c7210ce38fb394334a5da7a22ad2 | |
parent | 4bcd95705131c61a17e9fe7b7463a99149fc05b7 (diff) | |
parent | 8964a88b0810132c718e6760928ee66c05d8bd61 (diff) | |
download | pylint-22cd213f120fdb6e2e8b0bed7bd2ad5618aba064.tar.gz |
merge
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | checkers/variables.py | 3 | ||||
-rw-r--r-- | test/input/func_noerror_lambda_use_before_assign.py | 7 |
3 files changed, 10 insertions, 1 deletions
@@ -10,6 +10,7 @@ ChangeLog for PyLint * include James Lingar patches for function call arguments checker * improved flymake code and doc provided by Derek Harland * refactor & fix the imports checker + * fix #18862: E0601 false positive with lambda functions * fix #8764: More than one statement on a single line false positive with try/except/finally * Nathaniel's fix for w0108 false positive diff --git a/checkers/variables.py b/checkers/variables.py index 454fc9c..f17c940 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -380,7 +380,8 @@ builtins. Remember that you should avoid to define new builtins when possible.' if defstmt is stmt and isinstance(node, (astng.DelName, astng.AssName)): self.add_message('E0602', args=name, node=node) - else: + elif self._to_consume[-1][-1] != 'lambda': + # E0601 may *not* occurs in lambda scope self.add_message('E0601', args=name, node=node) if not isinstance(node, astng.AssName): # Aug AssName del to_consume[name] diff --git a/test/input/func_noerror_lambda_use_before_assign.py b/test/input/func_noerror_lambda_use_before_assign.py new file mode 100644 index 0000000..0ab8c2c --- /dev/null +++ b/test/input/func_noerror_lambda_use_before_assign.py @@ -0,0 +1,7 @@ +"""https://www.logilab.net/elo/ticket/18862""" +__revision__ = 1 +def function(): + """hop""" + ggg = lambda: xxx + xxx = 1 + print ggg() |