如何在代码中初始化set()以编译为pypy的rpython?

hig*_*dth 6 python pypy compilation set

我想用pypy的rpython转换器编译一些python代码.一个非常简单的玩具示例,它不做任何事情:

def main(argv):
 a = []
 b = set(a)
 print b
 return 0

def target(driver,args):
        return main,None
Run Code Online (Sandbox Code Playgroud)

如果我编译为:

python2.6 ~/Downloads/pypy-1.4.1-src/pypy/translator/goal/translate.py --output trypy trypy.py 
Run Code Online (Sandbox Code Playgroud)

它不会编译,而只是暂停,出现以下错误:

[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--
Run Code Online (Sandbox Code Playgroud)

如果我取出set()函数就可以了.你如何在rpython中使用集合?

hig*_*dth 4

所以官方说,rpython 中不支持 set() 。谢谢尝试PyPy。