sgzwiz / brython

Automatically exported from code.google.com/p/brython
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

List comprehension fails if quote is present in condition #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In console

l = [ "A", "B" ]
n = [ i for i in l if i.startswith("A") ]
print(n)

is expanded as

l =["A","B"]
n =$list_comp([["i","l"]],"i","i.startswith("A")") 
$print(n)

conditional expression is not properly escaped.

By extension, the absence of proper escaping causes also:

In console:
d = { "Marc Seberg" : "L'éclaircie" }
print(d)

Result in:
{'Marc Seberg':'L'éclaircie'}

Original issue reported on code.google.com by pedro.ro...@gmail.com on 30 Dec 2012 at 8:26

GoogleCodeExporter commented 9 years ago
Both issues were fixed in revision 279
Also fixed for [x for x in ["A","B"]]

Original comment by pierre.q...@gmail.com on 31 Dec 2012 at 8:38