本文整理汇总了Python中pypy.translator.interactive.Translation.source方法的典型用法代码示例。如果您正苦于以下问题:Python Translation.source方法的具体用法?Python Translation.source怎么用?Python Translation.source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypy.translator.interactive.Translation
的用法示例。
在下文中一共展示了Translation.source方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_simple_source_llvm
# 需要导入模块: from pypy.translator.interactive import Translation [as 别名]
# 或者: from pypy.translator.interactive.Translation import source [as 别名]
def test_simple_source_llvm():
from pypy.translator.llvm.test.runtest import llvm_test
llvm_test()
def f(x,y):
return x+y
t = Translation(f, [int, int], backend='llvm')
t.source(gc='boehm')
assert 'source_llvm' in t.driver.done
t = Translation(f, [int, int])
t.source_llvm()
assert 'source_llvm' in t.driver.done
示例2: test_simple_source
# 需要导入模块: from pypy.translator.interactive import Translation [as 别名]
# 或者: from pypy.translator.interactive.Translation import source [as 别名]
def test_simple_source():
def f(x, y):
return x,y
t = Translation(f, backend='c')
t.annotate([int, int])
t.source()
assert 'source_c' in t.driver.done
t = Translation(f, [int, int])
t.source_c()
assert 'source_c' in t.driver.done
t = Translation(f, [int, int])
py.test.raises(Exception, "t.source()")
示例3: test_simple_compile_c
# 需要导入模块: from pypy.translator.interactive import Translation [as 别名]
# 或者: from pypy.translator.interactive.Translation import source [as 别名]
def test_simple_compile_c():
def f(x,y):
return x+y
t = Translation(f, [int, int])
t.source(backend='c')
t_f = t.compile()
res = t_f(2,3)
assert res == 5
t = Translation(f, [int, int])
t_f = t.compile_c()
res = t_f(2,3)
assert res == 5