logilab-astng #6820 W0631 false positive [rejected]

I believe I've encountered a false positive (W0631) - a minimal test case is:

for x in []:

for x in range(3):
  print (lambda : x)() # W0631 here

Note that removing the first loop, or using 'x' directly, rather than in a lambda expression in the second, clears up the false positive.

It's not the same as #2463, since we're only ever using 'x' inside a loop (where it obviously must be defined). It might be the same as #6015, though.

syt update: not the same as #6015 which has been fixed. The problem is that we are defining the lambda and then calling it right away. IMO this can't be fixed at the astng level without much more execution flow understanding.

done in<not specified>
load left0.000
closed by<not specified>