I want to compile some python code using pypy's rpython translator. A very simple toy example that doesn't do anything :
def main(argv):
a = []
b = set(a)
print b
return 0
def target(driver,args):
return main,None
If I compile it as:
python2.6 ~/Downloads/pypy-1.4.1-src/pypy/translator/goal/translate.py --output trypy trypy.py
It doesn't compile, rather just halts with errors something like this:
[translation:ERROR] AttributeError': 'FrozenDesc' object has no attribute 'rowkey'
[translation:ERROR] .. v1 = simple_call((type set), v0)
[translation:ERROR] .. '(trypy:3)main'
[translation:ERROR] Processing block:
[translation:ERROR] block@0 is a <class 'pypy.objspace.flow.flowcontext.SpamBlock'>
[translation:ERROR] in (trypy:3)main
[translation:ERROR] containing the following operations:
[translation:ERROR] v0 = newlist()
[translation:ERROR] v1 = simple_call((type set), v0)
[translation:ERROR] v2 = str(v1)
[translation:ERROR] v3 = simple_call((function rpython_print_item), v2)
[translation:ERROR] v4 = simple_call((function rpython_print_newline))
[translation:ERROR] --end--
If I take out the set() function it works. How do you use sets in rpython?
So its official, set() is not supported in rpython. Thanks TryPyPy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With