Help! :)
Sam Ruby is giving a speech at OSCON tomorrow
about python on parrot.
The pirate tests run hourly against the latest
repository versions of pirate and parrot at:
http://pirate.tangentcode.com/
And wouldn't you know it... A bug on the parrot
side cropped up out of nowhere to break them!
Watch closely:
[~/pirate]: parrot listcomp.pir
[16, 26]
[~/pirate]: cp listcomp.pir now_it_works.pir
[~/pirate]: parrot now_it_works.pir
[15, 25, 16, 26]
The correct output is [15, 25, 16, 26] but
depending on the *filename* we sometimes get
the short version.
The python source is:
print [x+y for x in (1,2,3,4,5,6,7,8)
if x > 4
for y in (10,20)
if x < 7]
The generated pir code is at the end of this message.
Likewise, this code fails when the pir is read
from stdin (which is why pirate is failing).
On Sam's machine the "listcom.pir" filename
doesn't trigger the bug.
My guess is that something about the filename or
the argument list is changing parrot's behavior.
This is running against a freshly built copy
of parrot from subversion.
I don't have any clue where to look for this,
but if someone happens to know how to fix it
by tomorrow, I would really appreciate it, and
it would certainly leave the OSCON atendees with
a better impression of parrot!
- Michal
http://withoutane.com/
##############################################################
# generated by pirate on Wed Aug 3 23:02:54 2005
.sub __main__ @MAIN
new_pad 0
loadlib P1, 'python_group'
push_eh __py_catch
#
setline 1
new $P0, 'PyList' # (expressListComp:738)
new $P2, 'PyTuple' # (tupleExpression:354)
$P2=8 # (tupleExpression:355)
$P2[0]=1 # (tupleExpression:358)
$P2[1]=2 # (tupleExpression:358)
$P2[2]=3 # (tupleExpression:358)
$P2[3]=4 # (tupleExpression:358)
$P2[4]=5 # (tupleExpression:358)
$P2[5]=6 # (tupleExpression:358)
$P2[6]=7 # (tupleExpression:358)
$P2[7]=8 # (tupleExpression:358)
$P3 = iter $P2 # (visitFor:994)
for0:
unless $P3 goto endfor0 # (visitFor:1000)
$P4 = shift $P3 # (visitFor:1000)
store_lex -1, 'x', $P4 # (visitFor:1009)
setline 2
unless $P4 > 4 goto endif0 # (tupleExpression:354)
new $P5, 'PyTuple' # (tupleExpression:354)
$P5=2 # (tupleExpression:355)
$P5[0]=10 # (tupleExpression:358)
$P5[1]=20 # (tupleExpression:358)
$P6 = iter $P5 # (visitFor:994)
for1:
unless $P6 goto endfor1 # (visitFor:1000)
$P7 = shift $P6 # (visitFor:1000)
store_lex -1, 'y', $P7 # (visitFor:1009)
setline 4
find_lex $P8, 'x' # (lookupName:176)
unless $P8 < 7 goto endif1 # (infixExpression:423)
new $P9, 'PyObject' # (infixExpression:423)
$P9 = $P8 + $P7 # (infixExpression:428)
push $P0, $P9 # (visitListCompExpr:766)
endif1:
goto for1 # (goto:158)
endfor1:
endif0:
goto for0 # (goto:158)
endfor0:
print_item $P0 # (visitPrint:779)
print_newline # (visitPrintnl:787)
#
.return ()
__py_catch:
print_item P5
print_newline
.end