Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Commit

Permalink
fix linter: previous effect state could brake lambda arguments usage
Browse files Browse the repository at this point in the history
  • Loading branch information
baverman committed Jan 14, 2012
1 parent 4c1632f commit 8bbcaa1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 4 additions & 3 deletions supplement/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,10 @@ def visit_Lambda(self, node):
self.scope = Scope(self.scope)
self.scope.lineno = node.lineno
self.scope.offset = node.col_offset
with self.loop():
with self.indirect(False):
self.generic_visit(node)
with self.effect(None):
with self.loop():
with self.indirect(False):
self.generic_visit(node)

self.scope = self.scope.parent

Expand Down
7 changes: 7 additions & 0 deletions tests/test_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,10 @@ def test_lambda():
def foo():
return lambda boo, bar: boo + bar
''')

def test_lambda_assigned_to_var():
assert_names('''
def foo():
$result$ = lambda boo, bar: boo + bar
''')

0 comments on commit 8bbcaa1

Please sign in to comment.