Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
incompatible_assignment_identifiers_have_local_scope: Variable assignment inside function is not treated as local #8956
Description of the problem / feature request:
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
a_list =  def f4(): a_list +=  f4() print(a_list) # 
Running the same code using the Go implementation or Python:
a_list =  def f4(): a_list +=  f4() # local variable a_list referenced before assignment
Suggested fix: use
a_list =  def f4(): a_list.append(1) f4() # valid
Any other information, logs, or outputs that you want to share?
I expect the number of breakages to be very low. I've run it on some projects inside Google (27k packages loaded, 690k targets configured), I couldn't detect any breakage.
In case of breakage, the fix should be simple to do manually. I'll update the first message.
Apparently, there's no breakage in Baze downstream projects either: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/196