beeware / voc

A transpiler that converts Python code into Java bytecode

Home Page:http://beeware.org/voc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple list comprehensions on one line fail to find local variables

abrunyate opened this issue · comments

The code

def fun():
  x=2
  L=([x for i in range(4)], [j for j in range(4)])

fun()

does not execute, since the x in the first comprehension is not resolved. The compiler does produce a warning, but it's hard to spot high up in the tool chain (it went unnoticed when using briefcase->android). Splitting the line, of course, fixes the problem.

I don't know enough about how VOC works yet to know how hard it would be to enhance the keys to the code object dictionary (if indeed this is the solution).